Skip to content

Commit

Permalink
Minor refactor in readEmAsmArgs. NFC
Browse files Browse the repository at this point in the history
Split out from #19980
  • Loading branch information
sbc100 committed Aug 16, 2023
1 parent 5ecd2d9 commit bd6f10b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -2887,19 +2887,17 @@ addToLibrary({
#endif
// Floats are always passed as doubles, and doubles and int64s take up 8
// bytes (two 32-bit slots) in memory, align reads to these:
buf += (ch != 105/*i*/) & buf;
buf += (ch != {{{ charCode('i') }}}) & buf;
readEmAsmArgsArray.push(
ch == {{{ charCode('i') }}} ? HEAP32[buf] :
#if MEMORY64
// Special case for pointers under wasm64 which we read as int53 Numbers.
if (ch == 112/*p*/) {
readEmAsmArgsArray.push(readI53FromI64(buf++ << 2));
} else
// Special case for pointers under wasm64 which we read as int53 Numbers.
ch == {{{ charCode('p') }}} ? {{{ makeGetValue('buf++ << 2', 0, '*') }}} :
#endif
readEmAsmArgsArray.push(
ch == 105/*i*/ ? HEAP32[buf] :
#if WASM_BIGINT
(ch == 106/*j*/ ? HEAP64 : HEAPF64)[buf++ >> 1]
(ch == {{{ charCode('j') }}} ? HEAP64 : HEAPF64)[buf++ >> 1]
#else
HEAPF64[buf++ >> 1]
HEAPF64[buf++ >> 1]
#endif
);
++buf;
Expand Down
1 change: 1 addition & 0 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,7 @@ def test_inlinejs4(self):
''', 'false', assert_returncode=NON_ZERO)

def test_em_asm(self):
self.maybe_closure()
self.do_core_test('test_em_asm.cpp')

def test_em_asm_c(self):
Expand Down

0 comments on commit bd6f10b

Please sign in to comment.