This file contains global type definitions which are used throughout the entire engine and applications referencing it. Numeric types are asserted statically to gurantee expected size.
More...
Go to the source code of this file.
|
typedef unsigned char | u8 |
| Unsigned 8-bit integer. More...
|
|
typedef unsigned short | u16 |
| Unsigned 16-bit integer. More...
|
|
typedef unsigned int | u32 |
| Unsigned 32-bit integer. More...
|
|
typedef unsigned long long | u64 |
| Unsigned 64-bit integer. More...
|
|
typedef signed char | i8 |
| Signed 8-bit integer. More...
|
|
typedef signed short | i16 |
| Signed 16-bit integer. More...
|
|
typedef signed int | i32 |
| Signed 32-bit integer. More...
|
|
typedef signed long long | i64 |
| Signed 64-bit integer. More...
|
|
typedef float | f32 |
| 32-bit floating point number More...
|
|
typedef double | f64 |
| 64-bit floating point number More...
|
|
typedef int | b32 |
| 32-bit boolean type, used for APIs which require it More...
|
|
typedef _Bool | b8 |
| 8-bit boolean type More...
|
|
typedef struct krange | krange |
| A range, typically of memory. More...
|
|
typedef struct range32 | range32 |
| A range, typically of memory. More...
|
|
|
| STATIC_ASSERT (sizeof(u8)==1, "Expected u8 to be 1 byte.") |
| Assert u8 to be 1 byte. More...
|
|
| STATIC_ASSERT (sizeof(u16)==2, "Expected u16 to be 2 bytes.") |
| Assert u16 to be 2 bytes. More...
|
|
| STATIC_ASSERT (sizeof(u32)==4, "Expected u32 to be 4 bytes.") |
| Assert u32 to be 4 bytes. More...
|
|
| STATIC_ASSERT (sizeof(u64)==8, "Expected u64 to be 8 bytes.") |
| Assert u64 to be 8 bytes. More...
|
|
| STATIC_ASSERT (sizeof(i8)==1, "Expected i8 to be 1 byte.") |
| Assert i8 to be 1 byte. More...
|
|
| STATIC_ASSERT (sizeof(i16)==2, "Expected i16 to be 2 bytes.") |
| Assert i16 to be 2 bytes. More...
|
|
| STATIC_ASSERT (sizeof(i32)==4, "Expected i32 to be 4 bytes.") |
| Assert i32 to be 4 bytes. More...
|
|
| STATIC_ASSERT (sizeof(i64)==8, "Expected i64 to be 8 bytes.") |
| Assert i64 to be 8 bytes. More...
|
|
| STATIC_ASSERT (sizeof(f32)==4, "Expected f32 to be 4 bytes.") |
| Assert f32 to be 4 bytes. More...
|
|
| STATIC_ASSERT (sizeof(f64)==8, "Expected f64 to be 8 bytes.") |
| Assert f64 to be 8 bytes. More...
|
|
KINLINE u64 | get_aligned (u64 operand, u64 granularity) |
|
KINLINE krange | get_aligned_range (u64 offset, u64 size, u64 granularity) |
|
This file contains global type definitions which are used throughout the entire engine and applications referencing it. Numeric types are asserted statically to gurantee expected size.
- Author
- Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
- Version
- 2.0
- Date
- 2024-04-03
- Copyright
- Kohi Game Engine is Copyright (c) Travis Vroman 2021-2024
◆ false
◆ FLAG_GET
#define FLAG_GET |
( |
|
flags, |
|
|
|
flag |
|
) |
| ((flags & flag) == flag) |
Indicates if the provided flag is set in the given flags int.
◆ FLAG_SET
#define FLAG_SET |
( |
|
flags, |
|
|
|
flag, |
|
|
|
enabled |
|
) |
| (flags = (enabled ? (flags | flag) : (flags & ~flag))) |
Sets a flag within the flags int to enabled/disabled.
- Parameters
-
flags | The flags int to write to. |
flag | The flag to set. |
enabled | Indicates if the flag is enabled or not. |
◆ GIBIBYTES
#define GIBIBYTES |
( |
|
amount | ) |
((amount) * 1024ULL * 1024ULL * 1024ULL) |
Gets the number of bytes from amount of gibibytes (GiB) (1024*1024*1024)
◆ GIGABYTES
#define GIGABYTES |
( |
|
amount | ) |
((amount) * 1000ULL * 1000ULL * 1000ULL) |
Gets the number of bytes from amount of gigabytes (GB) (1000*1000*1000)
◆ I16_MAX
◆ I16_MIN
◆ I32_MAX
#define I32_MAX 2147483647 |
◆ I32_MIN
◆ I64_MAX
#define I64_MAX 9223372036854775807L |
◆ I64_MIN
◆ I8_MAX
◆ I8_MIN
◆ INVALID_ID
#define INVALID_ID 4294967295U |
◆ INVALID_ID_U16
#define INVALID_ID_U16 65535U |
◆ INVALID_ID_U32
◆ INVALID_ID_U64
#define INVALID_ID_U64 18446744073709551615UL |
Any id set to this should be considered invalid, and not actually pointing to a real object.
◆ INVALID_ID_U8
#define INVALID_ID_U8 255U |
◆ KAPI
◆ KCLAMP
#define KCLAMP |
( |
|
value, |
|
|
|
min, |
|
|
|
max |
|
) |
| |
Value: ((value <= min) ? min : (value >= max) ? max \
: value)
Clamps value to a range of min and max (inclusive).
- Parameters
-
value | The value to be clamped. |
min | The minimum value of the range. |
max | The maximum value of the range. |
- Returns
- The clamped value.
◆ KIBIBYTES
#define KIBIBYTES |
( |
|
amount | ) |
((amount) * 1024ULL) |
Gets the number of bytes from amount of kibibytes (KiB) (1024)
◆ KILOBYTES
#define KILOBYTES |
( |
|
amount | ) |
((amount) * 1000ULL) |
Gets the number of bytes from amount of kilobytes (KB) (1000)
◆ KINLINE
#define KINLINE static inline |
◆ KMAX
#define KMAX |
( |
|
x, |
|
|
|
y |
|
) |
| (x > y ? x : y) |
◆ KMIN
#define KMIN |
( |
|
x, |
|
|
|
y |
|
) |
| (x < y ? x : y) |
◆ KNOINLINE
◆ KOHI_DEBUG
◆ KOHI_HOT_RELOAD
#define KOHI_HOT_RELOAD 0 |
◆ KOHI_RELEASE
◆ MEBIBYTES
#define MEBIBYTES |
( |
|
amount | ) |
((amount) * 1024ULL * 1024ULL) |
Gets the number of bytes from amount of mebibytes (MiB) (1024*1024)
◆ MEGABYTES
#define MEGABYTES |
( |
|
amount | ) |
((amount) * 1000ULL * 1000ULL) |
Gets the number of bytes from amount of megabytes (MB) (1000*1000)
◆ STATIC_ASSERT
#define STATIC_ASSERT static_assert |
◆ true
◆ U16_MAX
◆ U16_MIN
◆ U32_MAX
#define U32_MAX 4294967295U |
◆ U32_MIN
◆ U64_MAX
#define U64_MAX 18446744073709551615UL |
◆ U64_MIN
◆ U8_MAX
◆ U8_MIN
◆ b32
32-bit boolean type, used for APIs which require it
◆ b8
◆ f32
32-bit floating point number
◆ f64
64-bit floating point number
◆ i16
◆ i32
◆ i64
typedef signed long long i64 |
◆ i8
◆ krange
A range, typically of memory.
◆ range32
A range, typically of memory.
◆ u16
typedef unsigned short u16 |
◆ u32
◆ u64
typedef unsigned long long u64 |
◆ u8
◆ get_aligned()
◆ get_aligned_range()
◆ STATIC_ASSERT() [1/10]
STATIC_ASSERT |
( |
sizeof(f32) |
= =4 , |
|
|
"Expected f32 to be 4 bytes." |
|
|
) |
| |
Assert f32 to be 4 bytes.
◆ STATIC_ASSERT() [2/10]
STATIC_ASSERT |
( |
sizeof(f64) |
= =8 , |
|
|
"Expected f64 to be 8 bytes." |
|
|
) |
| |
Assert f64 to be 8 bytes.
◆ STATIC_ASSERT() [3/10]
STATIC_ASSERT |
( |
sizeof(i16) |
= =2 , |
|
|
"Expected i16 to be 2 bytes." |
|
|
) |
| |
Assert i16 to be 2 bytes.
◆ STATIC_ASSERT() [4/10]
STATIC_ASSERT |
( |
sizeof(i32) |
= =4 , |
|
|
"Expected i32 to be 4 bytes." |
|
|
) |
| |
Assert i32 to be 4 bytes.
◆ STATIC_ASSERT() [5/10]
STATIC_ASSERT |
( |
sizeof(i64) |
= =8 , |
|
|
"Expected i64 to be 8 bytes." |
|
|
) |
| |
Assert i64 to be 8 bytes.
◆ STATIC_ASSERT() [6/10]
STATIC_ASSERT |
( |
sizeof(i8) |
= =1 , |
|
|
"Expected i8 to be 1 byte." |
|
|
) |
| |
◆ STATIC_ASSERT() [7/10]
STATIC_ASSERT |
( |
sizeof(u16) |
= =2 , |
|
|
"Expected u16 to be 2 bytes." |
|
|
) |
| |
Assert u16 to be 2 bytes.
◆ STATIC_ASSERT() [8/10]
STATIC_ASSERT |
( |
sizeof(u32) |
= =4 , |
|
|
"Expected u32 to be 4 bytes." |
|
|
) |
| |
Assert u32 to be 4 bytes.
◆ STATIC_ASSERT() [9/10]
STATIC_ASSERT |
( |
sizeof(u64) |
= =8 , |
|
|
"Expected u64 to be 8 bytes." |
|
|
) |
| |
Assert u64 to be 8 bytes.
◆ STATIC_ASSERT() [10/10]
STATIC_ASSERT |
( |
sizeof(u8) |
= =1 , |
|
|
"Expected u8 to be 1 byte." |
|
|
) |
| |