Skip to content

Commit 78180aa

Browse files
authored
Minor refactor in readEmAsmArgs. NFC (#20054)
Split out from #19980
1 parent 225e25f commit 78180aa

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/library.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -2887,19 +2887,17 @@ addToLibrary({
28872887
#endif
28882888
// Floats are always passed as doubles, and doubles and int64s take up 8
28892889
// bytes (two 32-bit slots) in memory, align reads to these:
2890-
buf += (ch != 105/*i*/) & buf;
2890+
buf += (ch != {{{ charCode('i') }}}) & buf;
2891+
readEmAsmArgsArray.push(
2892+
ch == {{{ charCode('i') }}} ? HEAP32[buf] :
28912893
#if MEMORY64
2892-
// Special case for pointers under wasm64 which we read as int53 Numbers.
2893-
if (ch == 112/*p*/) {
2894-
readEmAsmArgsArray.push(readI53FromI64(buf++ << 2));
2895-
} else
2894+
// Special case for pointers under wasm64 which we read as int53 Numbers.
2895+
ch == {{{ charCode('p') }}} ? {{{ makeGetValue('buf++ << 2', 0, '*') }}} :
28962896
#endif
2897-
readEmAsmArgsArray.push(
2898-
ch == 105/*i*/ ? HEAP32[buf] :
28992897
#if WASM_BIGINT
2900-
(ch == 106/*j*/ ? HEAP64 : HEAPF64)[buf++ >> 1]
2898+
(ch == {{{ charCode('j') }}} ? HEAP64 : HEAPF64)[buf++ >> 1]
29012899
#else
2902-
HEAPF64[buf++ >> 1]
2900+
HEAPF64[buf++ >> 1]
29032901
#endif
29042902
);
29052903
++buf;

test/test_core.py

+1
Original file line numberDiff line numberDiff line change
@@ -2144,6 +2144,7 @@ def test_inlinejs4(self):
21442144
''', 'false', assert_returncode=NON_ZERO)
21452145

21462146
def test_em_asm(self):
2147+
self.maybe_closure()
21472148
self.do_core_test('test_em_asm.cpp')
21482149

21492150
def test_em_asm_c(self):

0 commit comments

Comments
 (0)