[MLton-commit] r5559

Matthew Fluet fluet at mlton.org
Wed May 16 08:27:34 PDT 2007


Expose more word operations
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.fun
U   mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.sig

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.fun
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.fun	2007-05-16 15:26:49 UTC (rev 5558)
+++ mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.fun	2007-05-16 15:27:33 UTC (rev 5559)
@@ -53,6 +53,8 @@
 
 fun zero s = make (0, s)
 
+val hash = IntInf.hash o toIntInf
+
 local
    val make: (IntInf.t * Word.t -> IntInf.t) -> t * t -> t =
       fn f => fn (w, w') =>
@@ -175,6 +177,8 @@
          then make (f (toIntInfSg (w, s), toIntInfSg (w', s)), size w)
       else Error.bug (concat ["WordX.", name])
 in
+   val op div = make (IntInf.div, "div")
+   val op mod = make (IntInf.mod, "mod")
    val mul = make (IntInf.*, "mul")
    val quot = make (IntInf.quot, "quot")
    val rem = make (IntInf.rem, "rem")
@@ -187,6 +191,7 @@
          then f (toIntInfSg (w, sg), toIntInfSg (w', sg))
       else Error.bug (concat ["WordX.", name])
 in
+   val compare = make (IntInf.compare, "compare")
    val lt = make (IntInf.<, "lt")
    val le = make (IntInf.<=, "le")
    val gt = make (IntInf.>, "gt")

Modified: mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.sig
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.sig	2007-05-16 15:26:49 UTC (rev 5558)
+++ mlton/branches/on-20050822-x86_64-branch/mlton/atoms/word-x.sig	2007-05-16 15:27:33 UTC (rev 5559)
@@ -6,6 +6,7 @@
  *)
 
 type int = Int.t
+type word = Word.t
 
 signature WORD_X_STRUCTS = 
    sig
@@ -22,11 +23,14 @@
       val add: t * t -> t
       val allOnes: WordSize.t -> t
       val andb: t * t -> t
+      val compare: t * t * {signed: bool} -> order
+      val div: t * t * {signed: bool} -> t
       val equals: t * t -> bool
+      val fromChar: char -> t (* returns a word of size 8 *)
+      val fromIntInf: IntInf.t * WordSize.t -> t
       val ge: t * t * {signed: bool} -> bool
       val gt: t * t * {signed: bool} -> bool
-      val fromChar: char -> t (* returns a word of size 8 *)
-      val fromIntInf: IntInf.t * WordSize.t -> t
+      val hash: t -> word
       val isAllOnes: t -> bool
       val isOne: t -> bool
       val isMax: t * {signed: bool} -> bool
@@ -39,6 +43,7 @@
       val lt: t * t * {signed: bool} -> bool
       val max: WordSize.t * {signed: bool} -> t
       val min: WordSize.t * {signed: bool} -> t
+      val mod: t * t * {signed: bool} -> t
       val mul: t * t * {signed: bool} -> t
       val neg: t -> t
       val notb: t -> t




More information about the MLton-commit mailing list