on master help sign in
Insert U, UL, and ULL suffixes in C

Now, generated C constants for Bits8, Bits16, Bits32, and Bits64 get the appropriate suffixes for unsignedness and longness (-U, -U, -UL, -ULL, respectively). This gets rid of warnings and fixes #932.

commitae117aa9e2c3c415576646a7686d6b5ce9b45aa9 authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateMon 24 Mar 2014, 21:35 (13 years ago) parent7cea995
1 file changed+4−4
src/IRTS/CodegenC.hs+4−4
src/IRTS/CodegenC.hs+4−4
@@ -132,10 +132,10 @@ bcc i (ASSIGNCONST l c)
132132 mkConst (Fl f) = "MKFLOAT(vm, " ++ show f ++ ")"
133133 mkConst (Ch c) = "MKINT(" ++ show (fromEnum c) ++ ")"
134134 mkConst (Str s) = "MKSTR(vm, " ++ showCStr s ++ ")"
135− mkConst (B8 x) = "idris_b8const(vm, " ++ show x ++ ")"
136− mkConst (B16 x) = "idris_b16const(vm, " ++ show x ++ ")"
137− mkConst (B32 x) = "idris_b32const(vm, " ++ show x ++ ")"
138− mkConst (B64 x) = "idris_b64const(vm, " ++ show x ++ ")"
135+ mkConst (B8 x) = "idris_b8const(vm, " ++ show x ++ "U)"
136+ mkConst (B16 x) = "idris_b16const(vm, " ++ show x ++ "U)"
137+ mkConst (B32 x) = "idris_b32const(vm, " ++ show x ++ "UL)"
138+ mkConst (B64 x) = "idris_b64const(vm, " ++ show x ++ "ULL)"
139139 mkConst _ = "MKINT(42424242)"
140140bcc i (UPDATE l r) = indent i ++ creg l ++ " = " ++ creg r ++ ";\n"
141141bcc i (MKCON l tag args)