mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
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.
46 lines
1.0 KiB
Plaintext
46 lines
1.0 KiB
Plaintext
clamp(0, 0, 0) = 0
|
|
clamp(0, 0, 1) = 0
|
|
clamp(0, 0, 2) = 0
|
|
clamp(0, 0, 8) = 0
|
|
clamp(0, 0, 10) = 0
|
|
clamp(0, 0, 16) = 0
|
|
clamp(0, 0, 127) = 0
|
|
clamp(0, 0, 128) = 0
|
|
clamp(0, 0, 255) = 0
|
|
clamp(0, 5, 0) = 0
|
|
clamp(0, 5, 1) = 1
|
|
clamp(0, 5, 2) = 2
|
|
clamp(0, 5, 8) = 5
|
|
clamp(0, 5, 10) = 5
|
|
clamp(0, 5, 16) = 5
|
|
clamp(0, 5, 127) = 5
|
|
clamp(0, 5, 128) = 5
|
|
clamp(0, 5, 255) = 5
|
|
clamp(5, 10, 0) = 5
|
|
clamp(5, 10, 1) = 5
|
|
clamp(5, 10, 2) = 5
|
|
clamp(5, 10, 8) = 8
|
|
clamp(5, 10, 10) = 10
|
|
clamp(5, 10, 16) = 10
|
|
clamp(5, 10, 127) = 10
|
|
clamp(5, 10, 128) = 10
|
|
clamp(5, 10, 255) = 10
|
|
clamp(0, 255, 0) = 0
|
|
clamp(0, 255, 1) = 1
|
|
clamp(0, 255, 2) = 2
|
|
clamp(0, 255, 8) = 8
|
|
clamp(0, 255, 10) = 10
|
|
clamp(0, 255, 16) = 16
|
|
clamp(0, 255, 127) = 127
|
|
clamp(0, 255, 128) = 128
|
|
clamp(0, 255, 255) = 255
|
|
clamp(12, 6, 0) = <<exception>>
|
|
clamp(12, 6, 1) = <<exception>>
|
|
clamp(12, 6, 2) = <<exception>>
|
|
clamp(12, 6, 8) = <<exception>>
|
|
clamp(12, 6, 10) = <<exception>>
|
|
clamp(12, 6, 16) = <<exception>>
|
|
clamp(12, 6, 127) = <<exception>>
|
|
clamp(12, 6, 128) = <<exception>>
|
|
clamp(12, 6, 255) = <<exception>>
|