Comment by MrMcCall
2 months ago
How can you access the full 64 bits if "one bit is reserved for the OCaml runtime"? (the link is in the my original post's thread)
2 months ago
How can you access the full 64 bits if "one bit is reserved for the OCaml runtime"? (the link is in the my original post's thread)
The usual int type is 63 bits. You can get a full 64 bit int, it just isn't the default.
The docs say, "one bit is reserved for the OCaml runtime", so doesn't that mean that one of the bits (likely the high bit) are unavailable for the programmer's use?
I mean, I understand "reserved" to mean either "you can't depend upon it if you use it", or "it will break the runtime if you use it".
So the "one bit" you refer to is what makes the standard int 63 bits rather than 64. If you could do things with it it would indeed break the runtime- that's what tells it that you're working with an int rather than a pointer. But full, real, 64-bit integers are available, in the base language, same goes for 32.
9 replies →
https://ocaml.org/manual/5.3/api/Int64.html
3 replies →