This repository has been archived on 2026-04-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
bhlib/include/BH/Common.h

32 lines
911 B
C
Raw Permalink Normal View History

2025-01-18 17:24:36 +03:00
#ifndef BH_COMMON_H
#define BH_COMMON_H
#include <stddef.h>
#include <stdint.h>
#define BH_OK 0x0000
#define BH_ERROR 0x0001
#define BH_NOIMPL 0x0002
#define BH_OOM 0x0003
#define BH_INVALID 0x0004
#define BH_FOUND 0x0005
#define BH_NOTFOUND 0x0006
#define BH_TIMEOUT 0x0007
#define BH_SHORT 0x0008
#define BH_FULL 0x0009
2025-01-18 17:24:36 +03:00
#define BH_UNUSED(x) (void)(x)
#define BH_PTR2INT(x) ((intptr_t)(x))
#define BH_INT2PTR(x) ((void*)((intptr_t)(x)))
2025-01-18 17:24:36 +03:00
#define BH_CHECK_UADD_WRAP(x, y, type) ((type)((x) + (y)) < (type)(y))
#define BH_CHECK_USUB_WRAP(x, y, type) ((type)((x) - (y)) > (type)(x))
#define BH_CHECK_UMUL_WRAP(x, y, type) ((x) > ((type)-1 / (y)))
typedef int (*BH_EqualCallback)(const void *, const void *);
typedef size_t (*BH_HashCallback)(const void *);
typedef void (*BH_GenericCallback)(void *);
2025-01-18 17:24:36 +03:00
#endif /* BH_COMMON_H */