Skip to content

Non-canonical values when deserializing large integers from 32 bits arch on a 64 bits arch #148

Closed
@bclement-ocp

Description

@bclement-ocp

It is known that deserializing on a 32 bits machine a value in the range [2^31 .. 2^63[ that was serialized on a 64 bits machine will fail, because the value is not representable as an OCaml integer on 32 bits machines.

On the other hand, deserializing on a 64 bits machine a value in that range that was serialized on a 32 bits machine (including js_of_ocaml) will create a non-canonical value with semantics-breaking behavior (for instance, Z.(equal (x * one) x) does not hold).

Not sure if there is anything that can be done about it (I don't think deserialization code can fail), but it might be worth documenting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions