[MLton-commit] r5845

Vesa Karvonen vesak at mlton.org
Sat Aug 11 11:25:47 PDT 2007


Conversions and isomorphism between words ands word8.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/numeric/mk-word-ext.fun
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/wordable.sig

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml	2007-08-10 02:51:48 UTC (rev 5844)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml	2007-08-11 18:25:46 UTC (rev 5845)
@@ -22,6 +22,7 @@
 structure Int = struct open BasisInt type t = int end
 structure LargeInt = struct open BasisLargeInt type t = int end
 structure Word = struct open BasisWord type t = word end
+structure Word8 = struct open BasisWord8 type t = word end
 structure LargeWord = struct open BasisLargeWord type t = word end
 structure LargeReal = struct open BasisLargeReal type t = real end
 structure Word8Vector = struct open BasisWord8Vector type t = vector end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/numeric/mk-word-ext.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/numeric/mk-word-ext.fun	2007-08-10 02:51:48 UTC (rev 5844)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/numeric/mk-word-ext.fun	2007-08-11 18:25:46 UTC (rev 5845)
@@ -59,6 +59,8 @@
          val fromLittleBytes = mk BasisWord8Vector.foldr
       end
       val fromWord = fromLarge o BasisWord.toLarge
+      val fromWord8 = fromInt o BasisWord8.toInt
+      val fromWord8X = fromInt o BasisWord8.toIntX
       val fromWordX = fromLarge o BasisWord.toLargeX
       local
          fun mk idx w =
@@ -74,6 +76,8 @@
          val toLittleBytes = mk (fn i => i)
       end
       val toWord = BasisWord.fromLarge o toLarge
+      val toWord8 = BasisWord8.fromInt o toIntX
+      val toWord8X = toWord8
       val toWordX = BasisWord.fromLarge o toLargeX
       val embString = (toString, fromString)
       val isoBigBytes = (toBigBytes, fromBigBytes)
@@ -87,6 +91,8 @@
       val isoLargeWordX = isoLargeX
       val isoLittleBytes = (toLittleBytes, fromLittleBytes)
       val isoWord = (toWord, fromWord)
+      val isoWord8 = (toWord8, fromWord8)
+      val isoWord8X = (toWord8X, fromWord8X)
       val isoWordX = (toWordX, fromWordX)
       fun isZero w = fromInt 0 = w
       fun isEven w = isZero (andb (fromInt 1, w))

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/wordable.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/wordable.sig	2007-08-10 02:51:48 UTC (rev 5844)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/wordable.sig	2007-08-11 18:25:46 UTC (rev 5845)
@@ -13,17 +13,23 @@
    type wordable
    val fromLargeWord : LargeWord.t -> wordable
    val fromWord : Word.t -> wordable
+   val fromWord8 : Word8.t -> wordable
    val isoLargeWord : (wordable, LargeWord.t) Iso.t
    val isoWord : (wordable, Word.t) Iso.t
+   val isoWord8 : (wordable, Word8.t) Iso.t
    val toLargeWord : wordable -> LargeWord.t
    val toWord : wordable -> Word.t
+   val toWord8 : wordable -> Word8.t
 end
 
 signature WORDABLE_X = sig
    include WORDABLE
+   val fromWord8X : Word8.t -> wordable
    val fromWordX : Word.t -> wordable
    val isoLargeWordX : (wordable, LargeWord.t) Iso.t
+   val isoWord8X : (wordable, Word8.t) Iso.t
    val isoWordX : (wordable, Word.t) Iso.t
    val toLargeWordX : wordable -> LargeWord.t
+   val toWord8X : wordable -> Word8.t
    val toWordX : wordable -> Word.t
 end




More information about the MLton-commit mailing list