libbpg-0.9.7
This commit is contained in:
parent
35a8402710
commit
1261ac523b
11 changed files with 723 additions and 239 deletions
|
@ -1,3 +1,10 @@
|
|||
version 0.9.7:
|
||||
|
||||
- Increased the memory size of the JS decoder to 32 MiB and avoid
|
||||
polluting the global namespace.
|
||||
- Published the Emscripten patches which reduce the size of the
|
||||
generated JS code.
|
||||
|
||||
version 0.9.6:
|
||||
|
||||
- Faster encoding (x265 is the default encoder and is built in bpgenc).
|
||||
|
|
5
Makefile
5
Makefile
|
@ -49,8 +49,9 @@ endif
|
|||
# Emscriptem config
|
||||
EMLDFLAGS:=-s "EXPORTED_FUNCTIONS=['_bpg_decoder_open','_bpg_decoder_decode','_bpg_decoder_get_info','_bpg_decoder_start','_bpg_decoder_get_frame_duration','_bpg_decoder_get_line','_bpg_decoder_close','_malloc','_free']"
|
||||
EMLDFLAGS+=-s NO_FILESYSTEM=1 -s NO_BROWSER=1
|
||||
#EMLDFLAGS+=-O1 --post-js post.js
|
||||
EMLDFLAGS+=-O3 --memory-init-file 0 --closure 1 --post-js post.js
|
||||
#EMLDFLAGS+=-O1 --pre-js pre.js --post-js post.js
|
||||
# Note: the closure compiler is disabled because it adds unwanted global symbols
|
||||
EMLDFLAGS+=-O3 --memory-init-file 0 --closure 0 --pre-js pre.js --post-js post.js
|
||||
EMCFLAGS:=$(CFLAGS)
|
||||
|
||||
LDFLAGS=-g
|
||||
|
|
2
README
2
README
|
@ -240,7 +240,7 @@ will support this Javascript subset.
|
|||
9) x265 modifications
|
||||
---------------------
|
||||
|
||||
- Support of monochrome format (some part not used by BPG may be
|
||||
- Support of monochrome format (some parts not used by BPG may be
|
||||
missing).
|
||||
|
||||
- Support of static build.
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.9.6
|
||||
0.9.7
|
||||
|
|
656
emscripten.diff
Normal file
656
emscripten.diff
Normal file
|
@ -0,0 +1,656 @@
|
|||
diff --git a/src/fastLong.js b/src/fastLong.js
|
||||
index 2b70b2f..977c7ec 100644
|
||||
--- a/src/fastLong.js
|
||||
+++ b/src/fastLong.js
|
||||
@@ -12,47 +12,6 @@ function ___muldsi3($a, $b) {
|
||||
$12 = Math_imul($11, $1) | 0;
|
||||
return (tempRet0 = (($8 >>> 16) + (Math_imul($11, $6) | 0) | 0) + ((($8 & 65535) + $12 | 0) >>> 16) | 0, 0 | ($8 + $12 << 16 | $3 & 65535)) | 0;
|
||||
}
|
||||
-function ___divdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
- $a$0 = $a$0 | 0;
|
||||
- $a$1 = $a$1 | 0;
|
||||
- $b$0 = $b$0 | 0;
|
||||
- $b$1 = $b$1 | 0;
|
||||
- var $1$0 = 0, $1$1 = 0, $2$0 = 0, $2$1 = 0, $4$0 = 0, $4$1 = 0, $6$0 = 0, $7$0 = 0, $7$1 = 0, $8$0 = 0, $10$0 = 0;
|
||||
- $1$0 = $a$1 >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $1$1 = (($a$1 | 0) < 0 ? -1 : 0) >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $2$0 = $b$1 >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $2$1 = (($b$1 | 0) < 0 ? -1 : 0) >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $4$0 = _i64Subtract($1$0 ^ $a$0, $1$1 ^ $a$1, $1$0, $1$1) | 0;
|
||||
- $4$1 = tempRet0;
|
||||
- $6$0 = _i64Subtract($2$0 ^ $b$0, $2$1 ^ $b$1, $2$0, $2$1) | 0;
|
||||
- $7$0 = $2$0 ^ $1$0;
|
||||
- $7$1 = $2$1 ^ $1$1;
|
||||
- $8$0 = ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, 0) | 0;
|
||||
- $10$0 = _i64Subtract($8$0 ^ $7$0, tempRet0 ^ $7$1, $7$0, $7$1) | 0;
|
||||
- return (tempRet0 = tempRet0, $10$0) | 0;
|
||||
-}
|
||||
-function ___remdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
- $a$0 = $a$0 | 0;
|
||||
- $a$1 = $a$1 | 0;
|
||||
- $b$0 = $b$0 | 0;
|
||||
- $b$1 = $b$1 | 0;
|
||||
- var $rem = 0, $1$0 = 0, $1$1 = 0, $2$0 = 0, $2$1 = 0, $4$0 = 0, $4$1 = 0, $6$0 = 0, $10$0 = 0, $10$1 = 0, __stackBase__ = 0;
|
||||
- __stackBase__ = STACKTOP;
|
||||
- STACKTOP = STACKTOP + 8 | 0;
|
||||
- $rem = __stackBase__ | 0;
|
||||
- $1$0 = $a$1 >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $1$1 = (($a$1 | 0) < 0 ? -1 : 0) >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $2$0 = $b$1 >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $2$1 = (($b$1 | 0) < 0 ? -1 : 0) >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $4$0 = _i64Subtract($1$0 ^ $a$0, $1$1 ^ $a$1, $1$0, $1$1) | 0;
|
||||
- $4$1 = tempRet0;
|
||||
- $6$0 = _i64Subtract($2$0 ^ $b$0, $2$1 ^ $b$1, $2$0, $2$1) | 0;
|
||||
- ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, $rem) | 0;
|
||||
- $10$0 = _i64Subtract(HEAP32[$rem >> 2] ^ $1$0, HEAP32[$rem + 4 >> 2] ^ $1$1, $1$0, $1$1) | 0;
|
||||
- $10$1 = tempRet0;
|
||||
- STACKTOP = __stackBase__;
|
||||
- return (tempRet0 = $10$1, $10$0) | 0;
|
||||
-}
|
||||
function ___muldi3($a$0, $a$1, $b$0, $b$1) {
|
||||
$a$0 = $a$0 | 0;
|
||||
$a$1 = $a$1 | 0;
|
||||
@@ -66,234 +25,5 @@ function ___muldi3($a$0, $a$1, $b$0, $b$1) {
|
||||
$2 = Math_imul($a$1, $y_sroa_0_0_extract_trunc) | 0;
|
||||
return (tempRet0 = ((Math_imul($b$1, $x_sroa_0_0_extract_trunc) | 0) + $2 | 0) + $1$1 | $1$1 & 0, 0 | $1$0 & -1) | 0;
|
||||
}
|
||||
-function ___udivdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
- $a$0 = $a$0 | 0;
|
||||
- $a$1 = $a$1 | 0;
|
||||
- $b$0 = $b$0 | 0;
|
||||
- $b$1 = $b$1 | 0;
|
||||
- var $1$0 = 0;
|
||||
- $1$0 = ___udivmoddi4($a$0, $a$1, $b$0, $b$1, 0) | 0;
|
||||
- return (tempRet0 = tempRet0, $1$0) | 0;
|
||||
-}
|
||||
-function ___uremdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
- $a$0 = $a$0 | 0;
|
||||
- $a$1 = $a$1 | 0;
|
||||
- $b$0 = $b$0 | 0;
|
||||
- $b$1 = $b$1 | 0;
|
||||
- var $rem = 0, __stackBase__ = 0;
|
||||
- __stackBase__ = STACKTOP;
|
||||
- STACKTOP = STACKTOP + 8 | 0;
|
||||
- $rem = __stackBase__ | 0;
|
||||
- ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) | 0;
|
||||
- STACKTOP = __stackBase__;
|
||||
- return (tempRet0 = HEAP32[$rem + 4 >> 2] | 0, HEAP32[$rem >> 2] | 0) | 0;
|
||||
-}
|
||||
-function ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) {
|
||||
- $a$0 = $a$0 | 0;
|
||||
- $a$1 = $a$1 | 0;
|
||||
- $b$0 = $b$0 | 0;
|
||||
- $b$1 = $b$1 | 0;
|
||||
- $rem = $rem | 0;
|
||||
- var $n_sroa_0_0_extract_trunc = 0, $n_sroa_1_4_extract_shift$0 = 0, $n_sroa_1_4_extract_trunc = 0, $d_sroa_0_0_extract_trunc = 0, $d_sroa_1_4_extract_shift$0 = 0, $d_sroa_1_4_extract_trunc = 0, $4 = 0, $17 = 0, $37 = 0, $49 = 0, $51 = 0, $57 = 0, $58 = 0, $66 = 0, $78 = 0, $86 = 0, $88 = 0, $89 = 0, $91 = 0, $92 = 0, $95 = 0, $105 = 0, $117 = 0, $119 = 0, $125 = 0, $126 = 0, $130 = 0, $q_sroa_1_1_ph = 0, $q_sroa_0_1_ph = 0, $r_sroa_1_1_ph = 0, $r_sroa_0_1_ph = 0, $sr_1_ph = 0, $d_sroa_0_0_insert_insert99$0 = 0, $d_sroa_0_0_insert_insert99$1 = 0, $137$0 = 0, $137$1 = 0, $carry_0203 = 0, $sr_1202 = 0, $r_sroa_0_1201 = 0, $r_sroa_1_1200 = 0, $q_sroa_0_1199 = 0, $q_sroa_1_1198 = 0, $147 = 0, $149 = 0, $r_sroa_0_0_insert_insert42$0 = 0, $r_sroa_0_0_insert_insert42$1 = 0, $150$1 = 0, $151$0 = 0, $152 = 0, $154$0 = 0, $r_sroa_0_0_extract_trunc = 0, $r_sroa_1_4_extract_trunc = 0, $155 = 0, $carry_0_lcssa$0 = 0, $carry_0_lcssa$1 = 0, $r_sroa_0_1_lcssa = 0, $r_sroa_1_1_lcssa = 0, $q_sroa_0_1_lcssa = 0, $q_sroa_1_1_lcssa = 0, $q_sroa_0_0_insert_ext75$0 = 0, $q_sroa_0_0_insert_ext75$1 = 0, $q_sroa_0_0_insert_insert77$1 = 0, $_0$0 = 0, $_0$1 = 0;
|
||||
- $n_sroa_0_0_extract_trunc = $a$0;
|
||||
- $n_sroa_1_4_extract_shift$0 = $a$1;
|
||||
- $n_sroa_1_4_extract_trunc = $n_sroa_1_4_extract_shift$0;
|
||||
- $d_sroa_0_0_extract_trunc = $b$0;
|
||||
- $d_sroa_1_4_extract_shift$0 = $b$1;
|
||||
- $d_sroa_1_4_extract_trunc = $d_sroa_1_4_extract_shift$0;
|
||||
- if (($n_sroa_1_4_extract_trunc | 0) == 0) {
|
||||
- $4 = ($rem | 0) != 0;
|
||||
- if (($d_sroa_1_4_extract_trunc | 0) == 0) {
|
||||
- if ($4) {
|
||||
- HEAP32[$rem >> 2] = ($n_sroa_0_0_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
|
||||
- HEAP32[$rem + 4 >> 2] = 0;
|
||||
- }
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = ($n_sroa_0_0_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- } else {
|
||||
- if (!$4) {
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- HEAP32[$rem >> 2] = $a$0 & -1;
|
||||
- HEAP32[$rem + 4 >> 2] = $a$1 & 0;
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- }
|
||||
- $17 = ($d_sroa_1_4_extract_trunc | 0) == 0;
|
||||
- do {
|
||||
- if (($d_sroa_0_0_extract_trunc | 0) == 0) {
|
||||
- if ($17) {
|
||||
- if (($rem | 0) != 0) {
|
||||
- HEAP32[$rem >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
|
||||
- HEAP32[$rem + 4 >> 2] = 0;
|
||||
- }
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- if (($n_sroa_0_0_extract_trunc | 0) == 0) {
|
||||
- if (($rem | 0) != 0) {
|
||||
- HEAP32[$rem >> 2] = 0;
|
||||
- HEAP32[$rem + 4 >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_1_4_extract_trunc >>> 0);
|
||||
- }
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_1_4_extract_trunc >>> 0) >>> 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- $37 = $d_sroa_1_4_extract_trunc - 1 | 0;
|
||||
- if (($37 & $d_sroa_1_4_extract_trunc | 0) == 0) {
|
||||
- if (($rem | 0) != 0) {
|
||||
- HEAP32[$rem >> 2] = 0 | $a$0 & -1;
|
||||
- HEAP32[$rem + 4 >> 2] = $37 & $n_sroa_1_4_extract_trunc | $a$1 & 0;
|
||||
- }
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = $n_sroa_1_4_extract_trunc >>> ((_llvm_cttz_i32($d_sroa_1_4_extract_trunc | 0) | 0) >>> 0);
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- $49 = _llvm_ctlz_i32($d_sroa_1_4_extract_trunc | 0) | 0;
|
||||
- $51 = $49 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
|
||||
- if ($51 >>> 0 <= 30) {
|
||||
- $57 = $51 + 1 | 0;
|
||||
- $58 = 31 - $51 | 0;
|
||||
- $sr_1_ph = $57;
|
||||
- $r_sroa_0_1_ph = $n_sroa_1_4_extract_trunc << $58 | $n_sroa_0_0_extract_trunc >>> ($57 >>> 0);
|
||||
- $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($57 >>> 0);
|
||||
- $q_sroa_0_1_ph = 0;
|
||||
- $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $58;
|
||||
- break;
|
||||
- }
|
||||
- if (($rem | 0) == 0) {
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- HEAP32[$rem >> 2] = 0 | $a$0 & -1;
|
||||
- HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- } else {
|
||||
- if (!$17) {
|
||||
- $117 = _llvm_ctlz_i32($d_sroa_1_4_extract_trunc | 0) | 0;
|
||||
- $119 = $117 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
|
||||
- if ($119 >>> 0 <= 31) {
|
||||
- $125 = $119 + 1 | 0;
|
||||
- $126 = 31 - $119 | 0;
|
||||
- $130 = $119 - 31 >> 31;
|
||||
- $sr_1_ph = $125;
|
||||
- $r_sroa_0_1_ph = $n_sroa_0_0_extract_trunc >>> ($125 >>> 0) & $130 | $n_sroa_1_4_extract_trunc << $126;
|
||||
- $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($125 >>> 0) & $130;
|
||||
- $q_sroa_0_1_ph = 0;
|
||||
- $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $126;
|
||||
- break;
|
||||
- }
|
||||
- if (($rem | 0) == 0) {
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- HEAP32[$rem >> 2] = 0 | $a$0 & -1;
|
||||
- HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
|
||||
- $_0$1 = 0;
|
||||
- $_0$0 = 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- $66 = $d_sroa_0_0_extract_trunc - 1 | 0;
|
||||
- if (($66 & $d_sroa_0_0_extract_trunc | 0) != 0) {
|
||||
- $86 = (_llvm_ctlz_i32($d_sroa_0_0_extract_trunc | 0) | 0) + 33 | 0;
|
||||
- $88 = $86 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
|
||||
- $89 = 64 - $88 | 0;
|
||||
- $91 = 32 - $88 | 0;
|
||||
- $92 = $91 >> 31;
|
||||
- $95 = $88 - 32 | 0;
|
||||
- $105 = $95 >> 31;
|
||||
- $sr_1_ph = $88;
|
||||
- $r_sroa_0_1_ph = $91 - 1 >> 31 & $n_sroa_1_4_extract_trunc >>> ($95 >>> 0) | ($n_sroa_1_4_extract_trunc << $91 | $n_sroa_0_0_extract_trunc >>> ($88 >>> 0)) & $105;
|
||||
- $r_sroa_1_1_ph = $105 & $n_sroa_1_4_extract_trunc >>> ($88 >>> 0);
|
||||
- $q_sroa_0_1_ph = $n_sroa_0_0_extract_trunc << $89 & $92;
|
||||
- $q_sroa_1_1_ph = ($n_sroa_1_4_extract_trunc << $89 | $n_sroa_0_0_extract_trunc >>> ($95 >>> 0)) & $92 | $n_sroa_0_0_extract_trunc << $91 & $88 - 33 >> 31;
|
||||
- break;
|
||||
- }
|
||||
- if (($rem | 0) != 0) {
|
||||
- HEAP32[$rem >> 2] = $66 & $n_sroa_0_0_extract_trunc;
|
||||
- HEAP32[$rem + 4 >> 2] = 0;
|
||||
- }
|
||||
- if (($d_sroa_0_0_extract_trunc | 0) == 1) {
|
||||
- $_0$1 = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
|
||||
- $_0$0 = 0 | $a$0 & -1;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- } else {
|
||||
- $78 = _llvm_cttz_i32($d_sroa_0_0_extract_trunc | 0) | 0;
|
||||
- $_0$1 = 0 | $n_sroa_1_4_extract_trunc >>> ($78 >>> 0);
|
||||
- $_0$0 = $n_sroa_1_4_extract_trunc << 32 - $78 | $n_sroa_0_0_extract_trunc >>> ($78 >>> 0) | 0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
- }
|
||||
- }
|
||||
- } while (0);
|
||||
- if (($sr_1_ph | 0) == 0) {
|
||||
- $q_sroa_1_1_lcssa = $q_sroa_1_1_ph;
|
||||
- $q_sroa_0_1_lcssa = $q_sroa_0_1_ph;
|
||||
- $r_sroa_1_1_lcssa = $r_sroa_1_1_ph;
|
||||
- $r_sroa_0_1_lcssa = $r_sroa_0_1_ph;
|
||||
- $carry_0_lcssa$1 = 0;
|
||||
- $carry_0_lcssa$0 = 0;
|
||||
- } else {
|
||||
- $d_sroa_0_0_insert_insert99$0 = 0 | $b$0 & -1;
|
||||
- $d_sroa_0_0_insert_insert99$1 = $d_sroa_1_4_extract_shift$0 | $b$1 & 0;
|
||||
- $137$0 = _i64Add($d_sroa_0_0_insert_insert99$0, $d_sroa_0_0_insert_insert99$1, -1, -1) | 0;
|
||||
- $137$1 = tempRet0;
|
||||
- $q_sroa_1_1198 = $q_sroa_1_1_ph;
|
||||
- $q_sroa_0_1199 = $q_sroa_0_1_ph;
|
||||
- $r_sroa_1_1200 = $r_sroa_1_1_ph;
|
||||
- $r_sroa_0_1201 = $r_sroa_0_1_ph;
|
||||
- $sr_1202 = $sr_1_ph;
|
||||
- $carry_0203 = 0;
|
||||
- while (1) {
|
||||
- $147 = $q_sroa_0_1199 >>> 31 | $q_sroa_1_1198 << 1;
|
||||
- $149 = $carry_0203 | $q_sroa_0_1199 << 1;
|
||||
- $r_sroa_0_0_insert_insert42$0 = 0 | ($r_sroa_0_1201 << 1 | $q_sroa_1_1198 >>> 31);
|
||||
- $r_sroa_0_0_insert_insert42$1 = $r_sroa_0_1201 >>> 31 | $r_sroa_1_1200 << 1 | 0;
|
||||
- _i64Subtract($137$0, $137$1, $r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1) | 0;
|
||||
- $150$1 = tempRet0;
|
||||
- $151$0 = $150$1 >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
- $152 = $151$0 & 1;
|
||||
- $154$0 = _i64Subtract($r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1, $151$0 & $d_sroa_0_0_insert_insert99$0, ((($150$1 | 0) < 0 ? -1 : 0) >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1) & $d_sroa_0_0_insert_insert99$1) | 0;
|
||||
- $r_sroa_0_0_extract_trunc = $154$0;
|
||||
- $r_sroa_1_4_extract_trunc = tempRet0;
|
||||
- $155 = $sr_1202 - 1 | 0;
|
||||
- if (($155 | 0) == 0) {
|
||||
- break;
|
||||
- } else {
|
||||
- $q_sroa_1_1198 = $147;
|
||||
- $q_sroa_0_1199 = $149;
|
||||
- $r_sroa_1_1200 = $r_sroa_1_4_extract_trunc;
|
||||
- $r_sroa_0_1201 = $r_sroa_0_0_extract_trunc;
|
||||
- $sr_1202 = $155;
|
||||
- $carry_0203 = $152;
|
||||
- }
|
||||
- }
|
||||
- $q_sroa_1_1_lcssa = $147;
|
||||
- $q_sroa_0_1_lcssa = $149;
|
||||
- $r_sroa_1_1_lcssa = $r_sroa_1_4_extract_trunc;
|
||||
- $r_sroa_0_1_lcssa = $r_sroa_0_0_extract_trunc;
|
||||
- $carry_0_lcssa$1 = 0;
|
||||
- $carry_0_lcssa$0 = $152;
|
||||
- }
|
||||
- $q_sroa_0_0_insert_ext75$0 = $q_sroa_0_1_lcssa;
|
||||
- $q_sroa_0_0_insert_ext75$1 = 0;
|
||||
- $q_sroa_0_0_insert_insert77$1 = $q_sroa_1_1_lcssa | $q_sroa_0_0_insert_ext75$1;
|
||||
- if (($rem | 0) != 0) {
|
||||
- HEAP32[$rem >> 2] = 0 | $r_sroa_0_1_lcssa;
|
||||
- HEAP32[$rem + 4 >> 2] = $r_sroa_1_1_lcssa | 0;
|
||||
- }
|
||||
- $_0$1 = (0 | $q_sroa_0_0_insert_ext75$0) >>> 31 | $q_sroa_0_0_insert_insert77$1 << 1 | ($q_sroa_0_0_insert_ext75$1 << 1 | $q_sroa_0_0_insert_ext75$0 >>> 31) & 0 | $carry_0_lcssa$1;
|
||||
- $_0$0 = ($q_sroa_0_0_insert_ext75$0 << 1 | 0 >>> 31) & -2 | $carry_0_lcssa$0;
|
||||
- return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
-}
|
||||
// =======================================================================
|
||||
|
||||
diff --git a/src/jsifier.js b/src/jsifier.js
|
||||
index a717b79..51bab6f 100644
|
||||
--- a/src/jsifier.js
|
||||
+++ b/src/jsifier.js
|
||||
@@ -1883,8 +1883,14 @@ function JSify(data, functionsOnly) {
|
||||
}
|
||||
// these may be duplicated in side modules and the main module without issue
|
||||
print(read('fastLong.js'));
|
||||
+ if (!USE_BPG_STRIP)
|
||||
+ print(read('fastLongDiv.js'));
|
||||
print('// EMSCRIPTEN_END_FUNCS\n');
|
||||
- print(read('long.js'));
|
||||
+ if (PRECISE_I64_MATH == 2) {
|
||||
+ print('var i64Math = null;');
|
||||
+ } else {
|
||||
+ print(read('long.js'));
|
||||
+ }
|
||||
} else {
|
||||
print('// EMSCRIPTEN_END_FUNCS\n');
|
||||
print('// Warning: printing of i64 values may be slightly rounded! No deep i64 math used, so precise i64 code not included');
|
||||
diff --git a/src/postamble.js b/src/postamble.js
|
||||
index bac17ab..06800ee 100644
|
||||
--- a/src/postamble.js
|
||||
+++ b/src/postamble.js
|
||||
@@ -52,6 +52,7 @@ dependenciesFulfilled = function runCaller() {
|
||||
if (!Module['calledRun']) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
|
||||
}
|
||||
|
||||
+#if !USE_BPG_STRIP
|
||||
Module['callMain'] = Module.callMain = function callMain(args) {
|
||||
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on __ATMAIN__)');
|
||||
assert(__ATPRERUN__.length == 0, 'cannot call main when preRun functions remain to be called');
|
||||
@@ -108,6 +109,7 @@ Module['callMain'] = Module.callMain = function callMain(args) {
|
||||
calledMain = true;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
{{GLOBAL_VARS}}
|
||||
|
||||
@@ -142,9 +144,11 @@ function run(args) {
|
||||
Module.printErr('pre-main prep time: ' + (Date.now() - preloadStartTime) + ' ms');
|
||||
}
|
||||
|
||||
+#if !USE_BPG_STRIP
|
||||
if (Module['_main'] && shouldRunNow) {
|
||||
Module['callMain'](args);
|
||||
}
|
||||
+#endif
|
||||
|
||||
postRun();
|
||||
}
|
||||
diff --git a/src/preamble.js b/src/preamble.js
|
||||
index a1bc48e..9a2e36b 100644
|
||||
--- a/src/preamble.js
|
||||
+++ b/src/preamble.js
|
||||
@@ -633,6 +633,8 @@ function allocate(slab, types, allocator, ptr) {
|
||||
}
|
||||
Module['allocate'] = allocate;
|
||||
|
||||
+#if !USE_BPG_STRIP
|
||||
+
|
||||
function Pointer_stringify(ptr, /* optional */ length) {
|
||||
if (length === 0) return '';
|
||||
// TODO: use TextDecoder
|
||||
@@ -924,6 +926,11 @@ function demangle(func) {
|
||||
function demangleAll(text) {
|
||||
return text.replace(/__Z[\w\d_]+/g, function(x) { var y = demangle(x); return x === y ? x : (x + ' [' + y + ']') });
|
||||
}
|
||||
+#else
|
||||
+function demangleAll(text) {
|
||||
+ return text;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
function jsStackTrace() {
|
||||
var err = new Error();
|
||||
diff --git a/src/settings.js b/src/settings.js
|
||||
index eb34d2d..49a0a11 100644
|
||||
--- a/src/settings.js
|
||||
+++ b/src/settings.js
|
||||
@@ -594,6 +594,8 @@ var USE_SDL = 1; // Specify the SDL version that is being linked against.
|
||||
// 2 is a port of the SDL C code on emscripten-ports
|
||||
var USE_SDL_IMAGE = 1; // Specify the SDL_image version that is being linked against. Must match USE_SDL
|
||||
|
||||
+// strip unused code by BPG
|
||||
+var USE_BPG_STRIP = 1;
|
||||
|
||||
// Compiler debugging options
|
||||
var DEBUG_TAGS_SHOWING = [];
|
||||
diff --git a/src/fastLongDiv.js b/src/fastLongDiv.js
|
||||
new file mode 100644
|
||||
index 0000000..d1e5b49
|
||||
--- /dev/null
|
||||
+++ b/src/fastLongDiv.js
|
||||
@@ -0,0 +1,273 @@
|
||||
+// ======== compiled code from system/lib/compiler-rt , see readme therein
|
||||
+function ___divdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
+ $a$0 = $a$0 | 0;
|
||||
+ $a$1 = $a$1 | 0;
|
||||
+ $b$0 = $b$0 | 0;
|
||||
+ $b$1 = $b$1 | 0;
|
||||
+ var $1$0 = 0, $1$1 = 0, $2$0 = 0, $2$1 = 0, $4$0 = 0, $4$1 = 0, $6$0 = 0, $7$0 = 0, $7$1 = 0, $8$0 = 0, $10$0 = 0;
|
||||
+ $1$0 = $a$1 >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $1$1 = (($a$1 | 0) < 0 ? -1 : 0) >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $2$0 = $b$1 >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $2$1 = (($b$1 | 0) < 0 ? -1 : 0) >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $4$0 = _i64Subtract($1$0 ^ $a$0, $1$1 ^ $a$1, $1$0, $1$1) | 0;
|
||||
+ $4$1 = tempRet0;
|
||||
+ $6$0 = _i64Subtract($2$0 ^ $b$0, $2$1 ^ $b$1, $2$0, $2$1) | 0;
|
||||
+ $7$0 = $2$0 ^ $1$0;
|
||||
+ $7$1 = $2$1 ^ $1$1;
|
||||
+ $8$0 = ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, 0) | 0;
|
||||
+ $10$0 = _i64Subtract($8$0 ^ $7$0, tempRet0 ^ $7$1, $7$0, $7$1) | 0;
|
||||
+ return (tempRet0 = tempRet0, $10$0) | 0;
|
||||
+}
|
||||
+function ___remdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
+ $a$0 = $a$0 | 0;
|
||||
+ $a$1 = $a$1 | 0;
|
||||
+ $b$0 = $b$0 | 0;
|
||||
+ $b$1 = $b$1 | 0;
|
||||
+ var $rem = 0, $1$0 = 0, $1$1 = 0, $2$0 = 0, $2$1 = 0, $4$0 = 0, $4$1 = 0, $6$0 = 0, $10$0 = 0, $10$1 = 0, __stackBase__ = 0;
|
||||
+ __stackBase__ = STACKTOP;
|
||||
+ STACKTOP = STACKTOP + 8 | 0;
|
||||
+ $rem = __stackBase__ | 0;
|
||||
+ $1$0 = $a$1 >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $1$1 = (($a$1 | 0) < 0 ? -1 : 0) >> 31 | (($a$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $2$0 = $b$1 >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $2$1 = (($b$1 | 0) < 0 ? -1 : 0) >> 31 | (($b$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $4$0 = _i64Subtract($1$0 ^ $a$0, $1$1 ^ $a$1, $1$0, $1$1) | 0;
|
||||
+ $4$1 = tempRet0;
|
||||
+ $6$0 = _i64Subtract($2$0 ^ $b$0, $2$1 ^ $b$1, $2$0, $2$1) | 0;
|
||||
+ ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, $rem) | 0;
|
||||
+ $10$0 = _i64Subtract(HEAP32[$rem >> 2] ^ $1$0, HEAP32[$rem + 4 >> 2] ^ $1$1, $1$0, $1$1) | 0;
|
||||
+ $10$1 = tempRet0;
|
||||
+ STACKTOP = __stackBase__;
|
||||
+ return (tempRet0 = $10$1, $10$0) | 0;
|
||||
+}
|
||||
+function ___udivdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
+ $a$0 = $a$0 | 0;
|
||||
+ $a$1 = $a$1 | 0;
|
||||
+ $b$0 = $b$0 | 0;
|
||||
+ $b$1 = $b$1 | 0;
|
||||
+ var $1$0 = 0;
|
||||
+ $1$0 = ___udivmoddi4($a$0, $a$1, $b$0, $b$1, 0) | 0;
|
||||
+ return (tempRet0 = tempRet0, $1$0) | 0;
|
||||
+}
|
||||
+function ___uremdi3($a$0, $a$1, $b$0, $b$1) {
|
||||
+ $a$0 = $a$0 | 0;
|
||||
+ $a$1 = $a$1 | 0;
|
||||
+ $b$0 = $b$0 | 0;
|
||||
+ $b$1 = $b$1 | 0;
|
||||
+ var $rem = 0, __stackBase__ = 0;
|
||||
+ __stackBase__ = STACKTOP;
|
||||
+ STACKTOP = STACKTOP + 8 | 0;
|
||||
+ $rem = __stackBase__ | 0;
|
||||
+ ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) | 0;
|
||||
+ STACKTOP = __stackBase__;
|
||||
+ return (tempRet0 = HEAP32[$rem + 4 >> 2] | 0, HEAP32[$rem >> 2] | 0) | 0;
|
||||
+}
|
||||
+function ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) {
|
||||
+ $a$0 = $a$0 | 0;
|
||||
+ $a$1 = $a$1 | 0;
|
||||
+ $b$0 = $b$0 | 0;
|
||||
+ $b$1 = $b$1 | 0;
|
||||
+ $rem = $rem | 0;
|
||||
+ var $n_sroa_0_0_extract_trunc = 0, $n_sroa_1_4_extract_shift$0 = 0, $n_sroa_1_4_extract_trunc = 0, $d_sroa_0_0_extract_trunc = 0, $d_sroa_1_4_extract_shift$0 = 0, $d_sroa_1_4_extract_trunc = 0, $4 = 0, $17 = 0, $37 = 0, $49 = 0, $51 = 0, $57 = 0, $58 = 0, $66 = 0, $78 = 0, $86 = 0, $88 = 0, $89 = 0, $91 = 0, $92 = 0, $95 = 0, $105 = 0, $117 = 0, $119 = 0, $125 = 0, $126 = 0, $130 = 0, $q_sroa_1_1_ph = 0, $q_sroa_0_1_ph = 0, $r_sroa_1_1_ph = 0, $r_sroa_0_1_ph = 0, $sr_1_ph = 0, $d_sroa_0_0_insert_insert99$0 = 0, $d_sroa_0_0_insert_insert99$1 = 0, $137$0 = 0, $137$1 = 0, $carry_0203 = 0, $sr_1202 = 0, $r_sroa_0_1201 = 0, $r_sroa_1_1200 = 0, $q_sroa_0_1199 = 0, $q_sroa_1_1198 = 0, $147 = 0, $149 = 0, $r_sroa_0_0_insert_insert42$0 = 0, $r_sroa_0_0_insert_insert42$1 = 0, $150$1 = 0, $151$0 = 0, $152 = 0, $154$0 = 0, $r_sroa_0_0_extract_trunc = 0, $r_sroa_1_4_extract_trunc = 0, $155 = 0, $carry_0_lcssa$0 = 0, $carry_0_lcssa$1 = 0, $r_sroa_0_1_lcssa = 0, $r_sroa_1_1_lcssa = 0, $q_sroa_0_1_lcssa = 0, $q_sroa_1_1_lcssa = 0, $q_sroa_0_0_insert_ext75$0 = 0, $q_sroa_0_0_insert_ext75$1 = 0, $q_sroa_0_0_insert_insert77$1 = 0, $_0$0 = 0, $_0$1 = 0;
|
||||
+ $n_sroa_0_0_extract_trunc = $a$0;
|
||||
+ $n_sroa_1_4_extract_shift$0 = $a$1;
|
||||
+ $n_sroa_1_4_extract_trunc = $n_sroa_1_4_extract_shift$0;
|
||||
+ $d_sroa_0_0_extract_trunc = $b$0;
|
||||
+ $d_sroa_1_4_extract_shift$0 = $b$1;
|
||||
+ $d_sroa_1_4_extract_trunc = $d_sroa_1_4_extract_shift$0;
|
||||
+ if (($n_sroa_1_4_extract_trunc | 0) == 0) {
|
||||
+ $4 = ($rem | 0) != 0;
|
||||
+ if (($d_sroa_1_4_extract_trunc | 0) == 0) {
|
||||
+ if ($4) {
|
||||
+ HEAP32[$rem >> 2] = ($n_sroa_0_0_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
|
||||
+ HEAP32[$rem + 4 >> 2] = 0;
|
||||
+ }
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = ($n_sroa_0_0_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ } else {
|
||||
+ if (!$4) {
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ HEAP32[$rem >> 2] = $a$0 & -1;
|
||||
+ HEAP32[$rem + 4 >> 2] = $a$1 & 0;
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ }
|
||||
+ $17 = ($d_sroa_1_4_extract_trunc | 0) == 0;
|
||||
+ do {
|
||||
+ if (($d_sroa_0_0_extract_trunc | 0) == 0) {
|
||||
+ if ($17) {
|
||||
+ if (($rem | 0) != 0) {
|
||||
+ HEAP32[$rem >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_0_0_extract_trunc >>> 0);
|
||||
+ HEAP32[$rem + 4 >> 2] = 0;
|
||||
+ }
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_0_0_extract_trunc >>> 0) >>> 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ if (($n_sroa_0_0_extract_trunc | 0) == 0) {
|
||||
+ if (($rem | 0) != 0) {
|
||||
+ HEAP32[$rem >> 2] = 0;
|
||||
+ HEAP32[$rem + 4 >> 2] = ($n_sroa_1_4_extract_trunc >>> 0) % ($d_sroa_1_4_extract_trunc >>> 0);
|
||||
+ }
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = ($n_sroa_1_4_extract_trunc >>> 0) / ($d_sroa_1_4_extract_trunc >>> 0) >>> 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ $37 = $d_sroa_1_4_extract_trunc - 1 | 0;
|
||||
+ if (($37 & $d_sroa_1_4_extract_trunc | 0) == 0) {
|
||||
+ if (($rem | 0) != 0) {
|
||||
+ HEAP32[$rem >> 2] = 0 | $a$0 & -1;
|
||||
+ HEAP32[$rem + 4 >> 2] = $37 & $n_sroa_1_4_extract_trunc | $a$1 & 0;
|
||||
+ }
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = $n_sroa_1_4_extract_trunc >>> ((_llvm_cttz_i32($d_sroa_1_4_extract_trunc | 0) | 0) >>> 0);
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ $49 = _llvm_ctlz_i32($d_sroa_1_4_extract_trunc | 0) | 0;
|
||||
+ $51 = $49 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
|
||||
+ if ($51 >>> 0 <= 30) {
|
||||
+ $57 = $51 + 1 | 0;
|
||||
+ $58 = 31 - $51 | 0;
|
||||
+ $sr_1_ph = $57;
|
||||
+ $r_sroa_0_1_ph = $n_sroa_1_4_extract_trunc << $58 | $n_sroa_0_0_extract_trunc >>> ($57 >>> 0);
|
||||
+ $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($57 >>> 0);
|
||||
+ $q_sroa_0_1_ph = 0;
|
||||
+ $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $58;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (($rem | 0) == 0) {
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ HEAP32[$rem >> 2] = 0 | $a$0 & -1;
|
||||
+ HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ } else {
|
||||
+ if (!$17) {
|
||||
+ $117 = _llvm_ctlz_i32($d_sroa_1_4_extract_trunc | 0) | 0;
|
||||
+ $119 = $117 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
|
||||
+ if ($119 >>> 0 <= 31) {
|
||||
+ $125 = $119 + 1 | 0;
|
||||
+ $126 = 31 - $119 | 0;
|
||||
+ $130 = $119 - 31 >> 31;
|
||||
+ $sr_1_ph = $125;
|
||||
+ $r_sroa_0_1_ph = $n_sroa_0_0_extract_trunc >>> ($125 >>> 0) & $130 | $n_sroa_1_4_extract_trunc << $126;
|
||||
+ $r_sroa_1_1_ph = $n_sroa_1_4_extract_trunc >>> ($125 >>> 0) & $130;
|
||||
+ $q_sroa_0_1_ph = 0;
|
||||
+ $q_sroa_1_1_ph = $n_sroa_0_0_extract_trunc << $126;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (($rem | 0) == 0) {
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ HEAP32[$rem >> 2] = 0 | $a$0 & -1;
|
||||
+ HEAP32[$rem + 4 >> 2] = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
|
||||
+ $_0$1 = 0;
|
||||
+ $_0$0 = 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ $66 = $d_sroa_0_0_extract_trunc - 1 | 0;
|
||||
+ if (($66 & $d_sroa_0_0_extract_trunc | 0) != 0) {
|
||||
+ $86 = (_llvm_ctlz_i32($d_sroa_0_0_extract_trunc | 0) | 0) + 33 | 0;
|
||||
+ $88 = $86 - (_llvm_ctlz_i32($n_sroa_1_4_extract_trunc | 0) | 0) | 0;
|
||||
+ $89 = 64 - $88 | 0;
|
||||
+ $91 = 32 - $88 | 0;
|
||||
+ $92 = $91 >> 31;
|
||||
+ $95 = $88 - 32 | 0;
|
||||
+ $105 = $95 >> 31;
|
||||
+ $sr_1_ph = $88;
|
||||
+ $r_sroa_0_1_ph = $91 - 1 >> 31 & $n_sroa_1_4_extract_trunc >>> ($95 >>> 0) | ($n_sroa_1_4_extract_trunc << $91 | $n_sroa_0_0_extract_trunc >>> ($88 >>> 0)) & $105;
|
||||
+ $r_sroa_1_1_ph = $105 & $n_sroa_1_4_extract_trunc >>> ($88 >>> 0);
|
||||
+ $q_sroa_0_1_ph = $n_sroa_0_0_extract_trunc << $89 & $92;
|
||||
+ $q_sroa_1_1_ph = ($n_sroa_1_4_extract_trunc << $89 | $n_sroa_0_0_extract_trunc >>> ($95 >>> 0)) & $92 | $n_sroa_0_0_extract_trunc << $91 & $88 - 33 >> 31;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (($rem | 0) != 0) {
|
||||
+ HEAP32[$rem >> 2] = $66 & $n_sroa_0_0_extract_trunc;
|
||||
+ HEAP32[$rem + 4 >> 2] = 0;
|
||||
+ }
|
||||
+ if (($d_sroa_0_0_extract_trunc | 0) == 1) {
|
||||
+ $_0$1 = $n_sroa_1_4_extract_shift$0 | $a$1 & 0;
|
||||
+ $_0$0 = 0 | $a$0 & -1;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ } else {
|
||||
+ $78 = _llvm_cttz_i32($d_sroa_0_0_extract_trunc | 0) | 0;
|
||||
+ $_0$1 = 0 | $n_sroa_1_4_extract_trunc >>> ($78 >>> 0);
|
||||
+ $_0$0 = $n_sroa_1_4_extract_trunc << 32 - $78 | $n_sroa_0_0_extract_trunc >>> ($78 >>> 0) | 0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+ }
|
||||
+ }
|
||||
+ } while (0);
|
||||
+ if (($sr_1_ph | 0) == 0) {
|
||||
+ $q_sroa_1_1_lcssa = $q_sroa_1_1_ph;
|
||||
+ $q_sroa_0_1_lcssa = $q_sroa_0_1_ph;
|
||||
+ $r_sroa_1_1_lcssa = $r_sroa_1_1_ph;
|
||||
+ $r_sroa_0_1_lcssa = $r_sroa_0_1_ph;
|
||||
+ $carry_0_lcssa$1 = 0;
|
||||
+ $carry_0_lcssa$0 = 0;
|
||||
+ } else {
|
||||
+ $d_sroa_0_0_insert_insert99$0 = 0 | $b$0 & -1;
|
||||
+ $d_sroa_0_0_insert_insert99$1 = $d_sroa_1_4_extract_shift$0 | $b$1 & 0;
|
||||
+ $137$0 = _i64Add($d_sroa_0_0_insert_insert99$0, $d_sroa_0_0_insert_insert99$1, -1, -1) | 0;
|
||||
+ $137$1 = tempRet0;
|
||||
+ $q_sroa_1_1198 = $q_sroa_1_1_ph;
|
||||
+ $q_sroa_0_1199 = $q_sroa_0_1_ph;
|
||||
+ $r_sroa_1_1200 = $r_sroa_1_1_ph;
|
||||
+ $r_sroa_0_1201 = $r_sroa_0_1_ph;
|
||||
+ $sr_1202 = $sr_1_ph;
|
||||
+ $carry_0203 = 0;
|
||||
+ while (1) {
|
||||
+ $147 = $q_sroa_0_1199 >>> 31 | $q_sroa_1_1198 << 1;
|
||||
+ $149 = $carry_0203 | $q_sroa_0_1199 << 1;
|
||||
+ $r_sroa_0_0_insert_insert42$0 = 0 | ($r_sroa_0_1201 << 1 | $q_sroa_1_1198 >>> 31);
|
||||
+ $r_sroa_0_0_insert_insert42$1 = $r_sroa_0_1201 >>> 31 | $r_sroa_1_1200 << 1 | 0;
|
||||
+ _i64Subtract($137$0, $137$1, $r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1) | 0;
|
||||
+ $150$1 = tempRet0;
|
||||
+ $151$0 = $150$1 >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1;
|
||||
+ $152 = $151$0 & 1;
|
||||
+ $154$0 = _i64Subtract($r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1, $151$0 & $d_sroa_0_0_insert_insert99$0, ((($150$1 | 0) < 0 ? -1 : 0) >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1) & $d_sroa_0_0_insert_insert99$1) | 0;
|
||||
+ $r_sroa_0_0_extract_trunc = $154$0;
|
||||
+ $r_sroa_1_4_extract_trunc = tempRet0;
|
||||
+ $155 = $sr_1202 - 1 | 0;
|
||||
+ if (($155 | 0) == 0) {
|
||||
+ break;
|
||||
+ } else {
|
||||
+ $q_sroa_1_1198 = $147;
|
||||
+ $q_sroa_0_1199 = $149;
|
||||
+ $r_sroa_1_1200 = $r_sroa_1_4_extract_trunc;
|
||||
+ $r_sroa_0_1201 = $r_sroa_0_0_extract_trunc;
|
||||
+ $sr_1202 = $155;
|
||||
+ $carry_0203 = $152;
|
||||
+ }
|
||||
+ }
|
||||
+ $q_sroa_1_1_lcssa = $147;
|
||||
+ $q_sroa_0_1_lcssa = $149;
|
||||
+ $r_sroa_1_1_lcssa = $r_sroa_1_4_extract_trunc;
|
||||
+ $r_sroa_0_1_lcssa = $r_sroa_0_0_extract_trunc;
|
||||
+ $carry_0_lcssa$1 = 0;
|
||||
+ $carry_0_lcssa$0 = $152;
|
||||
+ }
|
||||
+ $q_sroa_0_0_insert_ext75$0 = $q_sroa_0_1_lcssa;
|
||||
+ $q_sroa_0_0_insert_ext75$1 = 0;
|
||||
+ $q_sroa_0_0_insert_insert77$1 = $q_sroa_1_1_lcssa | $q_sroa_0_0_insert_ext75$1;
|
||||
+ if (($rem | 0) != 0) {
|
||||
+ HEAP32[$rem >> 2] = 0 | $r_sroa_0_1_lcssa;
|
||||
+ HEAP32[$rem + 4 >> 2] = $r_sroa_1_1_lcssa | 0;
|
||||
+ }
|
||||
+ $_0$1 = (0 | $q_sroa_0_0_insert_ext75$0) >>> 31 | $q_sroa_0_0_insert_insert77$1 << 1 | ($q_sroa_0_0_insert_ext75$1 << 1 | $q_sroa_0_0_insert_ext75$0 >>> 31) & 0 | $carry_0_lcssa$1;
|
||||
+ $_0$0 = ($q_sroa_0_0_insert_ext75$0 << 1 | 0 >>> 31) & -2 | $carry_0_lcssa$0;
|
||||
+ return (tempRet0 = $_0$1, $_0$0) | 0;
|
||||
+}
|
||||
+// =======================================================================
|
||||
+
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
libbpg.h
2
libbpg.h
|
@ -24,6 +24,8 @@
|
|||
#ifndef _LIBBPG_H
|
||||
#define _LIBBPG_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef struct BPGDecoderContext BPGDecoderContext;
|
||||
|
||||
typedef enum {
|
||||
|
|
3
post.js
3
post.js
|
@ -212,3 +212,6 @@ window.onload = function() {
|
|||
dec.load(url);
|
||||
}
|
||||
};
|
||||
|
||||
/* end of dummy function enclosing all the emscripten code */
|
||||
})();
|
||||
|
|
25
pre.js
Normal file
25
pre.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* BPG Javascript decoder
|
||||
*
|
||||
* Copyright (c) 2014 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
(function () {
|
||||
var Module = {};
|
Loading…
Reference in a new issue