Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/system/Basis/Implementation/word64.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/word64.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1685, Thu Nov 11 16:51:42 2004 UTC revision 1686, Thu Nov 11 23:26:27 2004 UTC
# Line 9  Line 9 
9  structure Word64 : WORD = struct  structure Word64 : WORD = struct
10    
11      structure W32 = Word32Imp      structure W32 = Word32Imp
     structure II = IntInfImp  
     structure W64 = InlineT.Word64  
12    
13      type word = Word64.word      type word = Word64.word
14    
15      val extern = W64.extern      val extern = InlineT.Word64.extern
16      val intern = W64.intern      val intern = InlineT.Word64.intern
17    
18      val wordSize = 64      val wordSize = 64
19    
# Line 25  Line 23 
23      val toLargeWordX = unimplemented      val toLargeWordX = unimplemented
24      val fromLargeWord = unimplemented      val fromLargeWord = unimplemented
25    
26      fun toLargeInt w =      val toLargeInt = CoreIntInf.copyInf64 o extern
27          let val (hi, lo) = extern w      val toLargeIntX = CoreIntInf.extendInf64 o extern
28          in II.orb (II.<< (W32.toLargeInt hi, 0w32), W32.toLargeInt lo)      val fromLargeInt = intern o CoreIntInf.truncInf64
         end  
     fun toLargeIntX w =  
         let val (hi, lo) = extern w  
         in II.orb (II.<< (W32.toLargeIntX hi, 0w32), W32.toLargeInt lo)  
         end  
     fun fromLargeInt i =  
         intern (W32.fromLargeInt (II.~>> (i, 0w32)), W32.fromLargeInt i)  
29    
30      fun toInt w =      fun toInt w =
31          case extern w of          case extern w of
# Line 58  Line 49 
49      fun compare (w1, w2) =      fun compare (w1, w2) =
50          let val (hi1, lo1) = extern w1          let val (hi1, lo1) = extern w1
51              val (hi2, lo2) = extern w2              val (hi2, lo2) = extern w2
52          in          in if hi1 > hi2 then GREATER
             if hi1 > hi2 then GREATER  
53              else if hi1 < hi2 then LESS              else if hi1 < hi2 then LESS
54              else if lo1 > lo2 then GREATER              else if lo1 > lo2 then GREATER
55              else if lo1 < lo2 then LESS              else if lo1 < lo2 then LESS
# Line 119  Line 109 
109                 in w32bin hi ^ (StringCvt.padLeft #"0" 32 (w32bin lo))                 in w32bin hi ^ (StringCvt.padLeft #"0" 32 (w32bin lo))
110                 end)                 end)
111        | fmt StringCvt.HEX w = toString w        | fmt StringCvt.HEX w = toString w
112        | fmt rdx w = (* I am lazy *) II.fmt rdx (toLargeInt w)        | fmt rdx w = (* I am lazy *) IntInfImp.fmt rdx (toLargeInt w)
113    
114        (* piggy-back on intinf... *)
115        fun scan rdx rdr s =
116            case IntInfImp.scan rdx rdr s of
117                SOME (i, s') =>
118                  if i < 0 then NONE
119                  else if i > 0xffffffffffffffff then raise Overflow
120                  else SOME (fromLargeInt i, s')
121              | NONE =>  NONE
122    
123      fun scan rdx rdr s = unimplemented ()      val fromString = PreBasis.scanString (scan StringCvt.HEX)
     val fromString = unimplemented  
124    
125      val op * : word * word -> word = op *      val op * : word * word -> word = op *
126      val op + : word * word -> word = op +      val op + : word * word -> word = op +

Legend:
Removed from v.1685  
changed lines
  Added in v.1686

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0