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.
66 lines
1.7 KiB
66 lines
1.7 KiB
#ifndef _INTS_H
|
|
#define _INTS_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
|
|
#define IFUNC_NAME(name, ver) _impl__ ## name ## __ ## ver
|
|
#define IFUNC_IMPL(name, ver) __attribute__((copy(name))) IFUNC_NAME(name, ver)
|
|
#define IFUNC_RESOLVER_A(attr, name) __attribute__((returns_nonnull)) (* __attribute__(attr) _ifun__ ## name (void)) // When the ifunc resolver wants to return a function pointer that has attributes on it, the attribute inner list (e.g. `(returns_nonnull, const, nonnull)') can be provided as the first argument
|
|
#define IFUNC_RESOLVER(name) IFUNC_RESOLVER_A((copy(name)), name)
|
|
#define IFUNC_DEF(name, params) name params __attribute__((__ifunc__("_ifun__" #name)))
|
|
|
|
#define LIKELY(expr) __builtin_expect(!!(expr), 1)
|
|
#define UNLIKELY(expr) __builtin_expect(!!(expr), 0)
|
|
|
|
#define _export(kind) __attribute__((visibility(#kind)))
|
|
#define v_internal _export(internal)
|
|
#define v_protected _export(protected)
|
|
#define v_hidden _export(hidden)
|
|
|
|
#define _rng_internal v_internal
|
|
|
|
#define DEF(s, n) typedef s ## int ## n ## _t s ## n
|
|
#define DEFINT(n) typedef uint ## n ## _t u ## n; \
|
|
typedef int ## n ## _t i ## n
|
|
|
|
DEFINT(8);
|
|
DEFINT(16);
|
|
DEFINT(32);
|
|
DEFINT(64);
|
|
|
|
#ifdef __cplusplus
|
|
#else
|
|
#include <stdbool.h>
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
typedef signed __int128 i128;
|
|
typedef unsigned __int128 u128;
|
|
#pragma GCC diagnostic pop
|
|
#endif
|
|
typedef float f32;
|
|
typedef double f64;
|
|
|
|
typedef size_t usize;
|
|
typedef ssize_t isize;
|
|
|
|
typedef bool u1;
|
|
typedef bool i1;
|
|
|
|
typedef uintptr_t ptr_t;
|
|
|
|
#undef DEFINT
|
|
#undef DEF
|
|
|
|
#ifdef __cplusplus
|
|
#define restrict __restrict__
|
|
}
|
|
#endif
|
|
|
|
#endif /* _INTS_H */
|