-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
255u8.leading_zeros() is wrong on emscripten #39119
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-asmjsTarget: asm.js - http://asmjs.org/Target: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-asmjsTarget: asm.js - http://asmjs.org/Target: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!
Type
Fields
Give feedbackNo fields configured for issues without a type.
Running some tests this program is incorrect when run through emscripten currently:
This program prints 232 when I'd expect 0. This may be due to the implementation in emscripten-core/emscripten#4544 which looks like:
(in the compiled JS at least)
xcoming in is-1, soMath_clz32(x)returns 0, and then chopping of 24 returns -24. When interpreted as a u8 that's 232 (what we see).@kripken I'm not familiar with asmjs internals/representations, but is this a bug in the intrinsic? Or perhaps in our own representation of integers along the line? Or did I get unlucky with an LLVM mismatch or something?