read: implement basic decimal FIXes
[muddle-interpreter.git] / src / object.h
index 80c886e3051108c8c47fe886eee00c00dcc5b966..b62cacbd7793db78966e9cc86da31715d05b6491 100644 (file)
@@ -111,14 +111,14 @@ typedef struct
   alignas (16) evaltype type;
   pool_ptr rest;
   uint32_t _pad;
-  uint32_t val;
+  int32_t val;
 } fix32_object;
 
 typedef struct
 {
   alignas (16) evaltype type;
   pool_ptr rest;
-  uint64_t val;
+  int64_t val;
 } fix64_object;
 
 typedef struct
@@ -196,12 +196,20 @@ union object
 Initialization helpers.
 */
 
+static inline fix32_object
+new_fix32 (int32_t n)
+{
+  return (fix32_object)
+  {
+  .type = EVALTYPE_FIX32,.rest = 0,.val = n};
+}
+
 static inline fix64_object
-new_fix64 (uint64_t n)
+new_fix64 (int64_t n)
 {
   return (fix64_object)
   {
-  .type = EVALTYPE_FIX64,.rest = 0,.val = n,};
+  .type = EVALTYPE_FIX64,.rest = 0,.val = n};
 }
 
 static inline list_object