summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6329da4)
Allows upcasting a FIX32 by reading it as if it were a FIX64.
Signed-off-by: Kaz Wesley <kaz@lambdaverse.org>
- alignas (8) uint32_t _pad;
+ alignas (8)
+ // layout so that value can be upcast by reinterpreting as a fix64
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ int32_t n;
+ uint32_t _pad;
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ uint32_t _pad;
+#else
+#error Unusual endianness?
+#endif
} fix32_val;
typedef struct
{
} fix32_val;
typedef struct
{
+static inline fix32_object *
+as_fix32 (object * o)
+{
+ assert (TYPEPRIM_EQ (o->type, TYPEPRIM_FIX32));
+ return &o->fix32;
+}
+
static inline list_object *
as_list (object * o)
{
static inline list_object *
as_list (object * o)
{