Difference between revisions of "Types"
From MSX Game Library
Line 1: | Line 1: | ||
− | You can use standard C types but MSXgl provide some shortcut that help to write short code and makes data size and sign explicit (which is so important for creating efficient code). | + | You can use standard C types but MSXgl provide some shortcut that help to write short code and makes data size and sign explicit (which is so important for creating efficient code on a Z80). |
MSXgl's types can be found in [https://github.com/aoineko-fr/MSXgl/blob/main/engine/src/core.h core.h]. | MSXgl's types can be found in [https://github.com/aoineko-fr/MSXgl/blob/main/engine/src/core.h core.h]. |
Revision as of 19:53, 12 January 2024
You can use standard C types but MSXgl provide some shortcut that help to write short code and makes data size and sign explicit (which is so important for creating efficient code on a Z80).
MSXgl's types can be found in core.h.
Type | Desc. | SDCC equivalent |
---|---|---|
bool | Boolean (8 bits) | unsigned char |
i8 | 8 bits signed integer | signed char |
u8 | 8 bits unsigned integer | unsigned char |
i16 | 16 bits signed integer | signed short |
u16 | 16 bits unsigned integer | unsigned short |
i32 | 32 bits signed integer | signed long |
u32 | 32 bits unsigned integer | unsigned long |
i64 | 64 bits signed integer | signed long long |
u64 | 64 bits unsigned integer | unsigned long long |
f32 | 32 bits float (IEEE 754) | float |
c8 | 8 bits character (ASCII, UTF-8) | unsigned char |
c16 | 16 bits character (UTF-16, JIS, etc.) | unsigned short |
ptr | Pointer | void* |
callback | Callback default signature | void (*)(void) |
Related consant:
#define NULL 0 // Pointer "NULL" value #define TRUE 1 // Value for "TRUE" boolean #define FALSE 0 // Value for "FALSE" boolean
See also:
- Page about usage of boolean in MSXgl.
- SDCC documentation