Commit: 0ada27c25a107564321cdb43e884b9a9e9cb1484
Parent: c59ba1f5d312c5b1ea6929e35e3364242227d5a3
Author: Randy Palamar
Date: Sun, 22 Mar 2026 09:47:43 -0600
types: add f16 and "standard" bitmap header
also drop union from str8. while needing a cast is linux land is
ugly, it is more clear that it is the programmer's responsibility
to ensure 0 termination at those locations.
Diffstat:
2 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/rstd_platform.h b/rstd_platform.h
@@ -96,7 +96,6 @@ syscall4(LinuxSyscall n, s64 a1, s64 a2, s64 a3, s64 a4)
return result;
}
-
function force_inline u64
syscall5(LinuxSyscall n, s64 a1, s64 a2, s64 a3, s64 a4, s64 a5)
{
@@ -253,7 +252,7 @@ sys_open_file_at(str8 path, FileHandle directory, FileOpenFlags flags)
char cpath[MaxPathLength];
u64 path_length = Min(path.length, countof(cpath) - 1);
- memory_copy(cpath, path.str, path_length);
+ memory_copy(cpath, path.data, path_length);
cpath[path_length] = 0;
s32 linux_flags = 0;
diff --git a/rstd_types.h b/rstd_types.h
@@ -22,6 +22,7 @@
typedef __INT16_TYPE__ s16;
typedef __UINT8_TYPE__ u8;
typedef __INT8_TYPE__ s8;
+ typedef _Float16 f16;
#endif
typedef u8 b8;
@@ -46,9 +47,45 @@ typedef u64 uptr;
#define MB(a) ((u64)(a) << 20ULL)
#define KB(a) ((u64)(a) << 10ULL)
-typedef struct {s64 length; u16 *str;} str16;
-typedef struct {s64 length; union {u8 *str; s8 *c_str;}; } str8;
-#define str8(s) (str8){.length = (s64)sizeof(s) - 1, .str = (u8 *)s}
+typedef struct {s64 length; u16 *data;} str16;
+typedef struct {s64 length; u8 *data;} str8;
+
+#define str8(s) (str8){.length = (s64)sizeof(s) - 1, .data = (u8 *)s}
#define str8_comp(s) {sizeof(s) - 1, (u8 *)s}
+#pragma pack(push, 1)
+typedef struct {
+ u16 file_type;
+ u32 file_size;
+ u16 reserved_1;
+ u16 reserved_2;
+ u32 bitmap_offset;
+
+ u32 size;
+ s32 width;
+ s32 height;
+ u16 planes;
+ u16 bits_per_pixel;
+
+ u32 compression;
+ u32 size_of_bitmap;
+
+ s32 horizontal_resolution;
+ s32 vertical_resolution;
+ u32 colours_used;
+ u32 colours_important;
+
+ u32 red_mask;
+ u32 green_mask;
+ u32 blue_mask;
+ u32 alpha_mask;
+
+ u32 colour_space_type;
+ u32 cie_xyz_triples[9];
+ u32 gamma_red;
+ u32 gamma_green;
+ u32 gamma_blue;
+} rstd_bitmap_header;
+#pragma pack(pop)
+
#endif /* RSTD_TYPES_H */