mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
library/string.m:
Add functions for converting uint64s to strings of base 8 or base 16
digits. For most integer types we can cast to a uint and then use the
uint versions of these operations but for 64-bit types we cannot since
on some of our supported platforms uints are 32-bit.
NEWS:
Announce the additions.
tests/hard_coded/Mmakefile:
tests/hard_coded/uint64_string_conv.{m,exp}:
Add a test of the new functions.
30 lines
2.5 KiB
Plaintext
30 lines
2.5 KiB
Plaintext
Decimal Octal Hex HEX
|
|
0 0 0 0
|
|
1 1 1 1
|
|
2 2 2 2
|
|
3 3 3 3
|
|
4 4 4 4
|
|
7 7 7 7
|
|
8 10 8 8
|
|
9 11 9 9
|
|
10 12 a A
|
|
11 13 b B
|
|
12 14 c C
|
|
13 15 d D
|
|
14 16 e E
|
|
15 17 f F
|
|
16 20 10 10
|
|
32 40 20 20
|
|
64 100 40 40
|
|
127 177 7f 7F
|
|
128 200 80 80
|
|
255 377 ff FF
|
|
256 400 100 100
|
|
32767 77777 7fff 7FFF
|
|
65535 177777 ffff FFFF
|
|
2147483647 17777777777 7fffffff 7FFFFFFF
|
|
4294967295 37777777777 ffffffff FFFFFFFF
|
|
9223372036854775807 777777777777777777777 7fffffffffffffff 7FFFFFFFFFFFFFFF
|
|
18446744073709551615 1777777777777777777777 ffffffffffffffff FFFFFFFFFFFFFFFF
|
|
|