From 97d1c4246e167ab493175d890409c4154628760c Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sat, 22 May 2021 23:17:50 +0200 Subject: Include bin2carr on the tools directory --- tools/bin2carr/src/shorthand.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tools/bin2carr/src/shorthand.h (limited to 'tools/bin2carr/src/shorthand.h') diff --git a/tools/bin2carr/src/shorthand.h b/tools/bin2carr/src/shorthand.h new file mode 100644 index 0000000..9c2e2f0 --- /dev/null +++ b/tools/bin2carr/src/shorthand.h @@ -0,0 +1,35 @@ +#ifndef MIC_SHORTHAND_H +#define MIC_SHORTHAND_H + +#include +#include +#include +#include + +// +// This simple header just typedefs the basic C define types to a shorter name, +// loads the quality of life bool macro for _Bool and defines shorthand macros +// for byte sizes. We need that the targeted architecture uses the floating +// point representation as described on the IEEE-754 standard. +// + +_Static_assert(sizeof(double) == 8, "no support for IEEE-754"); +_Static_assert(sizeof(float) == 4, "no support for IEEE-754"); + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; +typedef float f32; +typedef double f64; + +#define KB(N) ((u64)(N) * 1024) +#define MB(N) ((u64)KB(N) * 1024) +#define GB(N) ((u64)MB(N) * 1024) +#define TB(N) ((u64)GB(N) * 1024) + +#endif // MIC_SHORTHAND_H -- cgit v1.2.1