diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-02-07 09:17:20 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-07 09:17:20 +0000 |
| commit | 618941390604b1a8d0d71c23143adb0ec805f906 (patch) | |
| tree | c519ed730582910d8f9f20a4658c59a2fea73c55 /src/types.cpp | |
| parent | 667ddc19076b118f844eff831c9cbe840918208b (diff) | |
| parent | cec84edcdd61e5db8f18c11b2320958f8c752541 (diff) | |
Merge pull request #4790 from odin-lang/bill/sdl3
`vendor:sdl3`
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp index 0b6e6d334..412448cbc 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1801,6 +1801,27 @@ gb_internal bool is_type_union_maybe_pointer_original_alignment(Type *t) { } +enum TypeEndianKind { + TypeEndian_Platform, + TypeEndian_Little, + TypeEndian_Big, +}; + +gb_internal TypeEndianKind type_endian_kind_of(Type *t) { + t = core_type(t); + if (t->kind == Type_Basic) { + if (t->Basic.flags & BasicFlag_EndianLittle) { + return TypeEndian_Little; + } + if (t->Basic.flags & BasicFlag_EndianBig) { + return TypeEndian_Big; + } + } else if (t->kind == Type_BitSet) { + return type_endian_kind_of(bit_set_to_int(t)); + } + return TypeEndian_Platform; +} + gb_internal bool is_type_endian_big(Type *t) { t = core_type(t); |