Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Chess engine performance is dependent on fast 64-bit integer operations. How does this implementation deal with javascript ints being limited to 32-bits? Is emscriptem somehow able to generate code using WASM's 64 bit ints?


It uses WASM which has 64bit integers.


Seems to be true. https://mbebenita.github.io/WasmExplorer/ emits i64.mul which is compiled to imul rax, rdi by firefox for the following code snippet:

    #include <stdint.h>
    
    uint64_t multiply(uint64_t a, uint64_t b){
        return a * b;
    }




I believe JS has access to 64-bit.


JS has access to 64-bit floating point, not int.


JS has BigInt support, a quick Google tells me this is supported by wasm. I'm not sure if they are doing that here or not.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...


BigInt is often orders of magnitude less performant than int32 so it's unlikely to be helpful in this situation.


Unless you're compiling from something like Cheerp.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: