Skip to content

Keep the endianness check when assertions are off for node #22391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/runtime_debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* SPDX-License-Identifier: MIT
*/

#if ASSERTIONS

#if (ASSERTIONS || ENVIRONMENT_MAY_BE_NODE) && !SUPPORT_BIG_ENDIAN
// Endianness check
#if !SUPPORT_BIG_ENDIAN
// Note that s390 node *occasionally* pops up and is big-endian.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

Suggested change
// Note that s390 node *occasionally* pops up and is big-endian.
// Note that s390 node *occasionally* pops up and is big-endian, so we check for
// endianness when node is enabled, even when assertions are off (no browser
// platform is big-endian AFAWCT, so we don't do that on web-only builds, to
// save size there).

(function() {
var h16 = new Int16Array(1);
var h8 = new Int8Array(h16.buffer);
Expand All @@ -16,6 +16,8 @@
})();
#endif

#if ASSERTIONS

function legacyModuleProp(prop, newName, incoming=true) {
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
Object.defineProperty(Module, prop, {
Expand Down
Loading