diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-10-27 20:25:28 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-10-27 20:25:28 -0400 |
| commit | 3907711d2abca4277e1dbe01b98e0c7f3cc1304e (patch) | |
| tree | 51bf124b217ac5f5f29314832a9937046ad04198 /fw/types.h | |
| parent | 8b7701ed93ac19ac386c4de460e1c3424a260262 (diff) | |
| download | can-gauge-interface-3907711d2abca4277e1dbe01b98e0c7f3cc1304e.zip | |
use builtin int types
Diffstat (limited to 'fw/types.h')
| -rw-r--r-- | fw/types.h | 43 |
1 files changed, 21 insertions, 22 deletions
@@ -13,28 +13,27 @@ typedef enum { } Status; typedef uint8_t U8; +typedef uint16_t U16; +typedef uint32_t U32; + typedef int8_t I8; +typedef int16_t I16; +typedef int32_t I32; +// Number typedef struct { - U8 hi, lo; -} U16; - -// Little-endian 32-bit unsigned integer. -typedef U8 U32[4]; - -// a + b -U16 addU16(U16 a, U16 b); - -// a + b -U16 addU16U8(U16 a, U8 b); - -// a << b -U16 lshiftU16(U16 a, U8 b); - -// a >> b -U16 rshiftU16(U16 a, U8 b); - -// -1 if a < b -// 0 if a == b -// +1 if a > b -I8 cmpU16(U16 a, U16 b); + enum { + NUM_U8, + NUM_U16, + NUM_U32, + NUM_I8, + NUM_I16, + NUM_I32, + } type; + U8 u8; + U16 u16; + U32 u32; + I8 i8; + I16 i16; + I32 i32; +} Number; |