Skip to content

Commit

Permalink
Reword comment about delicate points of unmarshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierleroy committed Jan 3, 2024
1 parent c37a465 commit 8c6a5d7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions caml_z.c
Original file line number Diff line number Diff line change
Expand Up @@ -3395,14 +3395,17 @@ static void ml_z_custom_serialize(value v,
#endif
}

/* XXX: serializing a large (i.e., > 2^31) int on a 64-bit machine and
deserializing on a 32-bit machine will fail (instead of returning a
block).
YYY: serializing a large (i.e., > 2^31 and < 2^62) int on a
32-bit machine and deserializing on a 64-bit machine must fail
(instead of returning a block containing a non-normalized big integer)
(issue #148).
*/
/* There are two issues with integers that are tagged ints on a 64-bit
machine but boxed bigints on a 32-bit machine, namely integers in the
[2^30, 2^62) and [-2^62, -2^30) ranges:
- Serializing such an integer on a 64-bit machine and
deserializing on a 32-bit machine will fail in the generic unmarshaler.
The correct behavior would be to return a boxed integer.
- Serializing such an integer on a 32-bit machine and
deserializing on a 64-bit machine must fail.
The wrong behavior would be to return a block containing a
non-normalized, boxed integer (issue #148).
*/
static uintnat ml_z_custom_deserialize(void * dst)
{
mp_limb_t* d = ((mp_limb_t*)dst) + 1;
Expand Down

0 comments on commit 8c6a5d7

Please sign in to comment.