1 (* Copyright (C
) 2009 Matthew Fluet
.
2 * Copyright (C
) 1999-2006 Henry Cejtin
, Matthew Fluet
, Suresh
3 * Jagannathan
, and Stephen Weeks
.
5 * MLton is released under a BSD
-style license
.
6 * See the file MLton
-LICENSE for details
.
15 val precision
: Pervasive
.Int.int option
16 val roundDownToPowerOfTwo
: t
-> t
17 val roundUpToPowerOfTwo
: t
-> t
21 structure Int = Pervasive
.Int
22 structure I
= Integer(open Int
23 fun divMod(a
, b
) = (a
div b
, a
mod b
)
24 fun quotRem(a
, b
) = (quot(a
, b
), rem(a
, b
))
25 val toIntInf
= Pervasive
.IntInf
.fromInt
)
28 fun roundDownToPowerOfTwo (i
: t
): t
=
29 Word.toInt (Word.roundDownToPowerOfTwo (Word.fromInt i
))
31 fun roundUpToPowerOfTwo (i
: t
): t
=
33 val i
' = roundDownToPowerOfTwo i
41 val maxInt
= Int.maxInt
42 val minInt
= Int.minInt
43 val precision
= Int.precision
44 val toReal
= Pervasive
.Real.fromInt