comparison src/prim.sml @ 276:ed4af33681d8

Switch base types to 64-bit versions
author Adam Chlipala <adamc@hcoop.net>
date Tue, 02 Sep 2008 14:59:27 -0400
parents c0ea24dcb86f
children e89076c41c39
comparison
equal deleted inserted replaced
275:73456bfde988 276:ed4af33681d8
39 case t of 39 case t of
40 Int n => string (Int64.toString n) 40 Int n => string (Int64.toString n)
41 | Float n => string (Real64.toString n) 41 | Float n => string (Real64.toString n)
42 | String s => box [string "\"", string (String.toString s), string "\""] 42 | String s => box [string "\"", string (String.toString s), string "\""]
43 43
44 fun int2s n =
45 if Int64.compare (n, Int64.fromInt 0) = LESS then
46 "-" ^ Int64.toString (Int64.~ n) ^ "LL"
47 else
48 Int64.toString n ^ "LL"
49
50 fun float2s n =
51 if Real64.compare (n, Real64.fromInt 0) = LESS then
52 "-" ^ Real64.toString (Real64.~ n) ^ "L"
53 else
54 Real64.toString n ^ "L"
55
56 fun p_t_GCC t =
57 case t of
58 Int n => string (int2s n)
59 | Float n => string (float2s n)
60 | String s => box [string "\"", string (String.toString s), string "\""]
61
44 fun equal x = 62 fun equal x =
45 case x of 63 case x of
46 (Int n1, Int n2) => n1 = n2 64 (Int n1, Int n2) => n1 = n2
47 | (Float n1, Float n2) => Real64.== (n1, n2) 65 | (Float n1, Float n2) => Real64.== (n1, n2)
48 | (String s1, String s2) => s1 = s2 66 | (String s1, String s2) => s1 = s2