Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / regression / int-inf.log2.sml
1 val _ =
2 List.app
3 (fn i => print (concat [Int.toString (IntInf.log2 i), "\n"]))
4 [1,
5 2,
6 3,
7 0x10000000,
8 0x20000000,
9 0x40000000,
10 0x80000000,
11 0x100000000,
12 0x1FFFFFFFF,
13 0x200000000,
14 0x200000001]
15
16 val _ =
17 List.app
18 (fn i =>
19 if i = IntInf.log2 (IntInf.pow (2, i))
20 andalso i = IntInf.log2 (IntInf.pow (2, i) + 1)
21 andalso i - 1 = IntInf.log2 (IntInf.pow (2, i) - 1)
22 then ()
23 else raise Fail "bug")
24 (List.tabulate (100, fn i => i + 1))
25
26 val _ = print "OK\n"
27
28
29
30