swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | typedef unsigned char uchar; |
| 4 | typedef unsigned short ushort; |
| 5 | typedef unsigned int uint; |
| 6 | typedef unsigned long ulong; |
| 7 | |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 8 | typedef unsigned long size_t; |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 9 | |
swissChili | cbd4363 | 2021-07-17 16:19:44 -0700 | [diff] [blame] | 10 | typedef signed long ssize_t; |
| 11 | |
swissChili | e4f0199 | 2021-02-25 15:38:12 -0800 | [diff] [blame] | 12 | typedef _Bool bool; |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 13 | |
| 14 | enum |
| 15 | { |
| 16 | false = 0, |
| 17 | true, |
| 18 | }; |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 19 | |
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 20 | #define NULL 0 |
swissChili | c2e62ed | 2021-03-10 17:04:18 -0800 | [diff] [blame] | 21 | #define MIN(a, b) ((a)>(b)?(b):(a)) |
| 22 | #define MAX(a, b) ((a)>(b)?(a):(b)) |
swissChili | e20b79b | 2021-03-17 21:20:13 -0700 | [diff] [blame] | 23 | |
swissChili | d98781b | 2021-07-25 21:04:17 -0700 | [diff] [blame] | 24 | #define UNUSED(val) ((void)(val)); |
| 25 | |
swissChili | 36ed5d7 | 2021-07-23 14:56:36 -0700 | [diff] [blame] | 26 | /// Pads num to an integer size boundary |
| 27 | #define PAD(num) ((num + 3) & (~0b11)) |
| 28 | |
| 29 | /// Perform integer division and round up |
| 30 | #define IDIV_CEIL(num, den) (((num) + ((den) - 1)) / (den)) |
| 31 | |
swissChili | e20b79b | 2021-03-17 21:20:13 -0700 | [diff] [blame] | 32 | // Coerce into 1 or 0 |
| 33 | #define BOOL(a) (!(!(a))) |