Git Product home page Git Product logo

integers_stubs_js's People

Contributors

mitschabaude avatar mrmr1993 avatar novemberkilo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

integers_stubs_js's Issues

Difference of behavior for `Unsigned.UInt32.to_int64`.

The native version of Unsigned.UInt32.to_int64 returns an int64 holding the exact same value as the given uint32, which I suppose is the expected behavior. The js stubs version, when the leftmost bit is 1, yields a different, very large number instead. I suspect the stubs are filling the 32 leftmost bits with ones instead zeroes.

let ui32 = Unsigned.UInt32.of_int 3748276426 in
let i64 = Unsigned.UInt32.to_int64 ui32 in
Format.eprintf "%Ld@." i64

Native output: 3748276426
Javascript output: 281478724987082

Compare does not work because we are using int64

The way UInt64s are handled does not properly install the written comparison function.

I believe this is because uint64 values are actually represented as int64 so the setting of custom functions here does nothing:

    caml_custom_ops["integers:uint64"] =
    { serialize: caml_int64_marshal
    , deserialize: caml_int64_unmarshal
    , hash: caml_int64_hash
    , compare: integers_uint64_compare };

As a result, the compare function for uint64s is the signed compare, and thus does not work correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.