[m-rev.] diff: add clamp/3 for other primitive integer types

Julien Fischer jfischer at opturion.com
Thu Mar 5 16:42:00 AEDT 2026


I will add clamp/4 for arbitrary precision integers separately.
Also, the behaviour of hard_coded/string_code_point seems
a bit suspicious (see XXX below).

----------------------------------------------------

Add clamp/3 for other primitive integer types.

library/int.m:
library/int{8,16,64}.m:
library/uint.m:
library/uint(8,16,32,64}.m:
    Add the new function.

NEWS.md:
    Announce the additions.

tests/hard_coded/Mmakefile:
tests/hard_coded/clamp_int*.{m,exp}:
tests/hard_coded/clamp_uint*.{m,exp}:
    Add tests for the new functions.

tests/hard_coded/string_code_point.m:
    Avoid an ambiguity due to this module defining its own version of clamp/3.
    XXX we should replace the local one with a call to int.clamp/3, but this
    module constructs ranges where Max < Min and aborts with the new one.

Julien.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.clamp.gz
Type: application/x-gzip
Size: 4924 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20260305/ffac8a1a/attachment.bin>


More information about the reviews mailing list