[MLton-commit] r4752

Vesa Karvonen vesak at mlton.org
Mon Oct 23 03:29:49 PDT 2006


Added WordX (or sign-extended) conversions.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-word-ext.fun
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/word.sig

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-word-ext.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-word-ext.fun	2006-10-23 09:26:44 UTC (rev 4751)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/mk-word-ext.fun	2006-10-23 10:29:46 UTC (rev 4752)
@@ -9,8 +9,11 @@
  *)
 functor MkWordExt (W : WORD) = struct
    open W
+   val bounds as (minWord, maxWord) = (fromInt 0, fromInt~1)
+   val fromWord = fromLarge o Word.toLarge
+   val fromWordX = fromLarge o Word.toLargeX
    val toWord = Word.fromLarge o toLarge
-   val fromWord = fromLarge o Word.toLarge
+   val toWordX = Word.fromLarge o toLargeX
    val embString = (toString, fromString)
    val isoInt = (toInt, fromInt)
    val isoIntX = (toIntX, fromInt)
@@ -19,8 +22,8 @@
    val isoLargeIntX = (toLargeIntX, fromLargeInt)
    val isoLargeX = (toLargeX, fromLarge)
    val isoWord = (toWord, fromWord)
+   val isoWordX = (toWordX, fromWordX)
    fun isZero w = fromInt 0 = w
    fun isEven w = isZero (andb (fromInt 1, w))
    val isOdd = not o isEven
-   val bounds as (minWord, maxWord) = (fromInt 0, fromInt~1)
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/word.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/word.sig	2006-10-23 09:26:44 UTC (rev 4751)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/word.sig	2006-10-23 10:29:46 UTC (rev 4752)
@@ -20,7 +20,10 @@
    (** == Conversions == *)
 
    val fromWord : Word.word -> word
+   val fromWordX : Word.word -> word
+
    val toWord : word -> Word.word
+   val toWordX : word -> Word.word
 
    (** == Embeddings == *)
 
@@ -35,6 +38,7 @@
    val isoLargeIntX : (word, LargeInt.int) iso
    val isoLargeX : (word, LargeWord.word) iso
    val isoWord : (word, Word.word) iso
+   val isoWordX : (word, Word.word) iso
 
    (** == Predicates == *)
 




More information about the MLton-commit mailing list