[MLton-commit] r6966

Vesa Karvonen vesak at mlton.org
Sat Nov 1 17:13:41 PST 2008


Minor optimization.

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

U   mlton/trunk/mlton/ast/word-size.fun

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

Modified: mlton/trunk/mlton/ast/word-size.fun
===================================================================
--- mlton/trunk/mlton/ast/word-size.fun	2008-10-31 15:35:20 UTC (rev 6965)
+++ mlton/trunk/mlton/ast/word-size.fun	2008-11-02 01:13:40 UTC (rev 6966)
@@ -108,12 +108,12 @@
 datatype prim = W8 | W16 | W32 | W64
 
 fun primOpt (s: t): prim option =
-   let
-      val b = Bits.toInt (bits s)
-   in
-      List.peekMap ([(8, W8), (16, W16), (32, W32), (64, W64)],
-                    fn (b', p) => if b = b' then SOME p else NONE)
-   end
+   case Bits.toInt (bits s) of
+      8 => SOME W8
+    | 16 => SOME W16
+    | 32 => SOME W32
+    | 64 => SOME W64
+    | _ => NONE
 
 fun prim s =
    case primOpt s of




More information about the MLton-commit mailing list