IntInf and word operations

Henry Cejtin henry@sourcelight.com
Fri, 22 Sep 2000 20:42:12 -0500


Sorry  about  the  fromLargeInt  problem.   I  forgot that IntInf.toInt would
overflow.  Here is one that is correct, but slow:

    fun fromLargeInt (i: IntInf.int): Word.word =
           let val low32 = IntInf.mod (i, 4294967296)       (* should be 1<<32 *)
           in if low32 >= 2147483648                        (* should be 1<<31 *)
                 then Word.fromInt (IntInf.toInt (low32 - 4294967296))
                 else Word.fromInt (IntInf.toInt low32)
           end