012345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
|
// util/util.h, version 1.0.1
// Utility header file from libutil
// Copyright (C) 2021, Jakob Wakeling
// MIT Licence
#ifndef UTIL_UTIL_H_KP8NS9DC
#define UTIL_UTIL_H_KP8NS9DC
#ifdef __cplusplus
extern "C" {
#endif
#include <assert.h>
#include <float.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/* Type Definitions */
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef uintptr_t UINT;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
typedef intptr_t sint;
typedef float f32;
typedef double f64;
typedef long double f128;
/* Type Limits */
#define U8_MIN UINT8_MIN
#define U8_MAX UINT8_MAX
#define U16_MIN UINT16_MIN
#define U16_MAX UINT16_MAX
#define U32_MIN UINT32_MIN
#define U32_MAX UINT32_MAX
#define U64_MIN UINT64_MIN
#define U64_MAX UINT64_MAX
#define UINT_MIN UINTPTR_MIN
#define UINT_MAX UINTPTR_MAX
#define S8_MIN INT8_MIN
#define S8_MAX INT8_MAX
#define S16_MIN INT16_MIN
#define S16_MAX INT16_MAX
#define S32_MIN INT32_MIN
#define S32_MAX INT32_MAX
#define S64_MIN INT64_MIN
#define S64_MAX INT64_MAX
#define SINT_MIN INTPTR_MIN
#define SINT_MAX INTPTR_MAX
#define F32_MIN FLT_MIN
#define F32_MAX FLT_MAX
#define F64_MIN DBL_MIN
#define F64_MAX DBL_MAX
#define F128_MIN LDBL_MIN
#define F128_MAX LDBL_MAX
/* Miscellaneous */
#define BIT(x) (1 << (x))
#ifdef __cplusplus
} // extern "C"
#endif
#endif // UTIL_UTIL_H_KP8NS9DC
|