Integer 128 split byte order helpers
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Dec 2023 14:51:43 +0000 (09:51 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Dec 2023 14:51:43 +0000 (09:51 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/side/abi/type-value.h

index de332d4b02e9a2f5b9a8f1b759dbf8a18d49a90b..0b5ed43c7e7bb6557ae0d1a6e868bc114e780938 100644 (file)
@@ -39,17 +39,33 @@ enum side_type_label_byte_order {
        SIDE_TYPE_BYTE_ORDER_BE = 1,
 };
 
+#if (SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN)
+enum side_integer128_split_index {
+       SIDE_INTEGER128_SPLIT_LOW = 0,
+       SIDE_INTEGER128_SPLIT_HIGH = 1,
+       NR_SIDE_INTEGER128_SPLIT,
+};
+#else
+enum side_integer128_split_index {
+       SIDE_INTEGER128_SPLIT_HIGH = 0,
+       SIDE_INTEGER128_SPLIT_LOW = 1,
+       NR_SIDE_INTEGER128_SPLIT,
+};
+#endif
+
 union side_integer_value {
        uint8_t side_u8;
        uint16_t side_u16;
        uint32_t side_u32;
        uint64_t side_u64;
-       uint64_t side_u128_split[2];
+       /* Indexed with enum side_integer128_split_index */
+       uint64_t side_u128_split[NR_SIDE_INTEGER128_SPLIT];
        int8_t side_s8;
        int16_t side_s16;
        int32_t side_s32;
        int64_t side_s64;
-       int64_t side_s128_split[2];
+       /* Indexed with enum side_integer128_split_index */
+       int64_t side_s128_split[NR_SIDE_INTEGER128_SPLIT];
        uintptr_t side_uptr;
        side_padding(32);
 } SIDE_PACKED;
This page took 0.023239 seconds and 4 git commands to generate.