You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
2.8 KiB
126 lines
2.8 KiB
2 years ago
|
#ifndef _TYPES_H
|
||
|
#define _TYPES_H
|
||
|
|
||
|
#include <stdint.h>
|
||
|
#include <stddef.h>
|
||
|
#include <sys/types.h>
|
||
|
|
||
|
#ifdef $int
|
||
|
#define $__bit_int(X) $int(X)
|
||
|
#else
|
||
|
#define $__bit_int(X) _BitInt(X)
|
||
|
#else
|
||
|
|
||
|
#endif
|
||
|
|
||
|
#define $__defint_x(N) \
|
||
|
typedef signed $__bit_int(N) i ## N; \
|
||
|
typedef unsigned $__bit_int(N) u ## N
|
||
|
|
||
|
#define $__defint(N) \
|
||
|
typedef int ## N ## _t i ## N; \
|
||
|
typedef uint ## N ## _T u ## N
|
||
|
|
||
|
#define $__INTS_8 \
|
||
|
$__defint_x(00); \
|
||
|
$__defint_x(01); \
|
||
|
$__defint_x(02); \
|
||
|
$__defint_x(03); \
|
||
|
$__defint_x(04); \
|
||
|
$__defint_x(05); \
|
||
|
$__defint_x(06); \
|
||
|
$__defint_x(07); \
|
||
|
$__defint(8)
|
||
|
|
||
|
#define $__INTS_16 \
|
||
|
$__defint_x(0x9); \
|
||
|
$__defint_x(0xa); \
|
||
|
$__defint_x(0xb); \
|
||
|
$__defint_x(0xc); \
|
||
|
$__defint_x(0xd); \
|
||
|
$__defint_x(0xe); \
|
||
|
$__defint_x(0xf); \
|
||
|
$__defint(16)
|
||
|
|
||
|
|
||
|
#define $__INTS_CHUNK_8F(N, ...) \
|
||
|
/*$__defint_x(0 ## N ## 0);*/ \
|
||
|
$__defint_x(0 ## N ## 1); \
|
||
|
$__defint_x(0 ## N ## 2); \
|
||
|
$__defint_x(0 ## N ## 3); \
|
||
|
$__defint_x(0 ## N ## 4); \
|
||
|
$__defint_x(0 ## N ## 5); \
|
||
|
$__defint_x(0 ## N ## 6); \
|
||
|
$__defint_x(0 ## N ## 7) \
|
||
|
__VA_OPT__(; $__defint(__VA_ARGS__))
|
||
|
|
||
|
#define $__INTS_CHUNK_8(N) \
|
||
|
$__defint_x(0 ## N ## 0); \
|
||
|
$__defint_x(0 ## N ## 1); \
|
||
|
$__defint_x(0 ## N ## 2); \
|
||
|
$__defint_x(0 ## N ## 3); \
|
||
|
$__defint_x(0 ## N ## 4); \
|
||
|
$__defint_x(0 ## N ## 5); \
|
||
|
$__defint_x(0 ## N ## 6); \
|
||
|
$__defint_x(0 ## N ## 7)
|
||
|
|
||
|
#define $__INTS_CHUNK_16(N) \
|
||
|
$__defint_x(0x ## N ## 0); \
|
||
|
$__defint_x(0x ## N ## 1); \
|
||
|
$__defint_x(0x ## N ## 2); \
|
||
|
$__defint_x(0x ## N ## 3); \
|
||
|
$__defint_x(0x ## N ## 4); \
|
||
|
$__defint_x(0x ## N ## 5); \
|
||
|
$__defint_x(0x ## N ## 6); \
|
||
|
$__defint_x(0x ## N ## 7); \
|
||
|
$__defint_x(0x ## N ## 8); \
|
||
|
$__defint_x(0x ## N ## 9); \
|
||
|
$__defint_x(0x ## N ## a); \
|
||
|
$__defint_x(0x ## N ## b); \
|
||
|
$__defint_x(0x ## N ## c); \
|
||
|
$__defint_x(0x ## N ## d); \
|
||
|
$__defint_x(0x ## N ## e); \
|
||
|
$__defint_x(0x ## N ## f)
|
||
|
|
||
|
#define $__INTS_CHUNK_16F(N, d) \
|
||
|
$__defint_x(0x ## N ## 1); \
|
||
|
$__defint_x(0x ## N ## 2); \
|
||
|
$__defint_x(0x ## N ## 3); \
|
||
|
$__defint_x(0x ## N ## 4); \
|
||
|
$__defint_x(0x ## N ## 5); \
|
||
|
$__defint_x(0x ## N ## 6); \
|
||
|
$__defint_x(0x ## N ## 7); \
|
||
|
$__defint_x(0x ## N ## 8); \
|
||
|
$__defint_x(0x ## N ## 9); \
|
||
|
$__defint_x(0x ## N ## a); \
|
||
|
$__defint_x(0x ## N ## b); \
|
||
|
$__defint_x(0x ## N ## c); \
|
||
|
$__defint_x(0x ## N ## d); \
|
||
|
$__defint_x(0x ## N ## e); \
|
||
|
$__defint_x(0x ## N ## f); \
|
||
|
$__defint(d)
|
||
|
|
||
|
// Define `{i,u}{0...128}`
|
||
|
$__INTS_8;
|
||
|
$__INTS_16;
|
||
|
$__INTS_CHUNK_8F(1); //24
|
||
|
$__INTS_CHUNK_16(1);//, 32);
|
||
|
$__INTS_CHUNK_16(2);//, 48);
|
||
|
$__INTS_CHUNK_16(3);//, 64);
|
||
|
$__INTS_CHUNK_16(4);//, 80);
|
||
|
$__INTS_CHUNK_16(5);//, 96);
|
||
|
$__INTS_CHUNK_16(6)//, 128);
|
||
|
|
||
|
typedef signed __int128 i128;
|
||
|
typedef unsigned __int128 u128;
|
||
|
|
||
|
typedef size_t usize;
|
||
|
typedef ssize_t isize;
|
||
|
|
||
|
typedef _Float16 f16;
|
||
|
typedef float f32;
|
||
|
typedef double f64;
|
||
|
typedef long double f128;
|
||
|
|
||
|
#endif /* _TYPES_H */
|