2 structure MII
= MLton
.IntInf
4 structure BigWord
= MLton
.IntInf
.BigWord
5 structure SmallInt
= MLton
.IntInf
.SmallInt
6 datatype rep
= datatype MLton
.IntInf
.rep
7 val toRep
= MLton
.IntInf
.rep
8 val fromRep
= MLton
.IntInf
.fromRep
13 print (concat
["checkToFrom ",
21 then print (concat
["toRep ", IntInf
.toString ii
, " = ",
24 | Small _
=> "Small\n"])
28 NONE
=> bug
"(isSome (fromRep r)) failed"
33 else bug
"(r = (toRep ii')) failed"
34 else bug
"(ii = ii') failed"
44 then (checkToFrom ii
; iloop (ii
+ 1))
54 val op div = SmallInt
.div
55 val two
= SmallInt
.fromInt
2
56 val thirtytwo
= SmallInt
.fromInt
32
57 val sixtyfour
= thirtytwo
+ thirtytwo
59 val min
= valOf SmallInt
.minInt
60 val hmin
= min
div two
61 val max
= valOf SmallInt
.maxInt
62 val hmax
= max
div two
64 [(SmallInt
.toLarge min
, SmallInt
.toLarge (min
+ sixtyfour
)),
65 (SmallInt
.toLarge (hmin
- thirtytwo
), SmallInt
.toLarge (hmin
+ thirtytwo
)),
66 (SmallInt
.toLarge (hmax
- thirtytwo
), SmallInt
.toLarge (hmax
+ thirtytwo
)),
67 (SmallInt
.toLarge (max
- sixtyfour
), SmallInt
.toLarge max
)]
71 val prec
= valOf SmallInt
.precision
72 val min
= ~
(IntInf
.pow (2, prec
- 1))
74 val max
= IntInf
.pow (2, prec
- 1) - 1
78 ((hmin
- 32), (hmin
+ 32)),
79 ((hmax
- 32), (hmax
+ 32)),