[MLton-commit] r5748
Vesa Karvonen
vesak at mlton.org
Mon Jul 9 17:04:26 PDT 2007
Added largestPrime. The primes, except for n<8, were obtained from
http://primes.utm.edu/lists/2small/0bit.html .
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/numeric/mk-word-ext.fun
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/numeric/word.sig
----------------------------------------------------------------------
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-07-09 17:00:15 UTC (rev 5747)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/numeric/mk-word-ext.fun 2007-07-10 00:04:25 UTC (rev 5748)
@@ -21,6 +21,27 @@
type shiftable = t
type stringable = t
type wordable = t
+ val largestPrime =
+ (~ o fromInt)
+ (case wordSize of
+ 1 => 1 | 2 => 1 | 3 => 1 | 4 => 3
+ | 5 => 1 | 6 => 3 | 7 => 1 | 8 => 5
+ | 9 => 3 | 10 => 3 | 11 => 9 | 12 => 3
+ | 13 => 1 | 14 => 3 | 15 => 19 | 16 => 15
+ | 17 => 1 | 18 => 5 | 19 => 1 | 20 => 3
+ | 21 => 9 | 22 => 3 | 23 => 15 | 24 => 3
+ | 25 => 39 | 26 => 5 | 27 => 39 | 28 => 57
+ | 29 => 3 | 30 => 35 | 31 => 1 | 32 => 5
+ | 33 => 9 | 34 => 41 | 35 => 31 | 36 => 5
+ | 37 => 25 | 38 => 45 | 39 => 7 | 40 => 87
+ | 41 => 21 | 42 => 11 | 43 => 57 | 44 => 17
+ | 45 => 55 | 46 => 21 | 47 => 115 | 48 => 59
+ | 49 => 81 | 50 => 27 | 51 => 129 | 52 => 47
+ | 53 => 111 | 54 => 33 | 55 => 55 | 56 => 5
+ | 57 => 13 | 58 => 27 | 59 => 55 | 60 => 93
+ | 61 => 1 | 62 => 57 | 63 => 25 | 64 => 59
+ | _ => raise Fail ("largestPrime less than pow (2, "^
+ BasisInt.toString wordSize^") not known"))
val bounds = (fromInt 0, fromInt~1)
val numBytes = BasisInt.quot (BasisInt.+ (wordSize, 7), 8)
local
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/numeric/word.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/numeric/word.sig 2007-07-09 17:00:15 UTC (rev 5747)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/numeric/word.sig 2007-07-10 00:04:25 UTC (rev 5748)
@@ -32,6 +32,9 @@
* is always equal to {(wordSize + 7) quot 8}.
*)
+ val largestPrime : t
+ (** Largest prime that fits in the word. *)
+
(** == Conversions == *)
val fromBigBytes : Word8Vector.t -> t
More information about the MLton-commit
mailing list