Skip to content

Commit 331da19

Browse files
committed
Fix for the crash on big endian machine. (#197)
Signed-off-by: Konstantin Maksimov <[email protected]>
1 parent 9ec1f94 commit 331da19

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/v8/v8.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,11 @@ bool V8::setWord(uint64_t pointer, Word word) {
441441
if (pointer + size > memory_->data_size()) {
442442
return false;
443443
}
444+
#if BYTE_ORDER == LITTLE_ENDIAN
444445
uint32_t word32 = word.u32();
446+
#else
447+
uint32_t word32 = __builtin_bswap32(word.u32());
448+
#endif
445449
::memcpy(memory_->data() + pointer, &word32, size);
446450
return true;
447451
}

0 commit comments

Comments
 (0)