diff options
Diffstat (limited to 'include/kpl/value.h')
| -rw-r--r-- | include/kpl/value.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/kpl/value.h b/include/kpl/value.h new file mode 100644 index 0000000..1e05c00 --- /dev/null +++ b/include/kpl/value.h @@ -0,0 +1,51 @@ +/* + * KPL values based on size + */ + +#pragma once + +#define _KPL_VALUE8 \ + uint8_t u8; \ + int8_t i8 + +typedef union { + _KPL_VALUE8; +} kpl_value8; + +#define _KPL_VALUE16 \ + uint16_t u16; \ + int16_t i16 + +typedef union { + _KPL_VALUE8; + _KPL_VALUE16; +} kpl_value16; + +typedef uint8_t kpl_utf8[4]; + +#define _KPL_VALUE32 \ + kpl_utf8 utf8; \ + uint32_t u32; \ + int32_t i32; \ + float f32 + +typedef union { + _KPL_VALUE8; + _KPL_VALUE16; + _KPL_VALUE32; +} kpl_value32; + +typedef union { + _KPL_VALUE8; + _KPL_VALUE16; + _KPL_VALUE32; + uint64_t u64; + int64_t i64; + double f64; + void *ptr; +} kpl_value64; + +typedef struct { + kpl_value64 value; + int64_t tag; +} kpl_result; |
