aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library.js31
-rw-r--r--src/library_sdl.js7
2 files changed, 35 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js
index b9c13055..104b0dc4 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4771,15 +4771,42 @@ LibraryManager.library = {
// type_info for void*.
_ZTIPv: [0],
+ llvm_uadd_with_overflow_i8: function(x, y) {
+ x = x & 0xff;
+ y = y & 0xff;
+ return {
+ f0: (x+y) & 0xff,
+ f1: x+y > 255
+ };
+ },
+
+ llvm_umul_with_overflow_i8: function(x, y) {
+ x = x & 0xff;
+ y = y & 0xff;
+ return {
+ f0: (x*y) & 0xff,
+ f1: x*y > 255
+ };
+ },
+
llvm_uadd_with_overflow_i16: function(x, y) {
- x = (x>>>0) & 0xffff;
- y = (y>>>0) & 0xffff;
+ x = x & 0xffff;
+ y = y & 0xffff;
return {
f0: (x+y) & 0xffff,
f1: x+y > 65535
};
},
+ llvm_umul_with_overflow_i16: function(x, y) {
+ x = x & 0xffff;
+ y = y & 0xffff;
+ return {
+ f0: (x*y) & 0xffff,
+ f1: x*y > 65535
+ };
+ },
+
llvm_uadd_with_overflow_i32: function(x, y) {
x = x>>>0;
y = y>>>0;
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 88649c38..73848502 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -952,7 +952,12 @@ var LibrarySDL = {
SDL_MapRGB: function(fmt, r, g, b) {
// Canvas screens are always RGBA
- return r + (g << 8) + (b << 16);
+ return 0xff+((b&0xff)<<8)+((g&0xff)<<16)+((r&0xff)<<24)
+ },
+
+ SDL_MapRGBA: function(fmt, r, g, b, a) {
+ // Canvas screens are always RGBA
+ return (a&0xff)+((b&0xff)<<8)+((g&0xff)<<16)+((r&0xff)<<24)
},
SDL_WM_GrabInput: function() {},