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/int32.sml
ViewVC logotype

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

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

revision 1179, Tue Mar 26 03:04:46 2002 UTC revision 1180, Tue Mar 26 22:24:24 2002 UTC
# Line 36  Line 36 
36      fun op rem(a:int,b:int):int =  I32.-(a, I32.*(b, I32.quot(a, b)))      fun op rem(a:int,b:int):int =  I32.-(a, I32.*(b, I32.quot(a, b)))
37      fun abs(a:int):int = if I32.<(a, 0) then I32.~(a) else a      fun abs(a:int):int = if I32.<(a, 0) then I32.~(a) else a
38    
39      fun op div(a:int, b:int):int = if I32.>=(b, 0)      fun op div(a:int, b:int):int =
40            then if I32.>=(a, 0)          let val q = I32.quot (a, b)
41              then I32.quot(a, b)          in
42              else I32.-(I32.quot(I32.+(a, 1), b), 1)              if I32.>= (q, 0) then q
43            else if I32.>(a,0)              else if I32.= (a, I32.* (q, b)) then q
44              then I32.-(I32.quot(I32.-(a, 1), b), 1)              else I32.- (q, 1)
45              else I32.quot(a, b)          end
46    
47      fun op mod(a:int, b:int):int = if I32.>=(b, 0)      fun op mod(a:int, b:int):int =
48            then if I32.>=(a, 0)          let val q = I32.quot (a, b)
49              then I32.-(a, I32.*(I32.quot(a, b), b))              val r = I32.- (a, I32.* (q, b))
50              else I32.+(I32.-(a, I32.*(I32.quot(I32.+(a,1), b), b)), b)          in
51            else if I32.>(a, 0)              if I32.>= (q, 0) orelse I32.= (r, 0) then r
52              then I32.+(I32.-(a, I32.*(I32.quot(I32.-(a,1), b), b)), b)              else I32.+ (r, b)
53            else if I32.=(a, ~2147483648) andalso I32.=(b, ~1)          end
             then 0  
             else I32.-(a, I32.*(I32.quot(a, b), b))  
54    
55      fun sign(0) = 0      fun sign(0) = 0
56        | sign i = if I32.<(i, 0) then ~1 else 1        | sign i = if I32.<(i, 0) then ~1 else 1

Legend:
Removed from v.1179  
changed lines
  Added in v.1180

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