Add static and runtime assert

This commit is contained in:
Krzosa Karol
2022-06-15 10:30:33 +02:00
parent e984049429
commit aab89ffada
6 changed files with 76 additions and 10 deletions

View File

@@ -13,8 +13,6 @@ UTF16_Result :: struct
len : S32
error : S32
BINARY :: 0b1001
utf8_to_utf32 :: (c: *U8, max_advance: S64): UTF32_Result
result: UTF32_Result
if (c[0] & 0b10000000) == 0
@@ -91,18 +89,14 @@ utf32_to_utf16 :: (codepoint: U32): UTF16_Result
// return result;
// }
Vec2I :: struct;; x: S32; y: S32
Vec2 :: struct;; x: F32; y: F32
Windows_Bitmap :: struct
size: Vec2I
data: *U32
hdc: HDC
dib: HBITMAP
Vec2I :: struct;; x: S32; y: S32
Vec2 :: struct;; x: F32; y: F32
create_bitmap :: (size: Vec2I, bottom_up: Bool = true): Windows_Bitmap
result: Windows_Bitmap = {size = size}
if bottom_up == false
@@ -136,6 +130,7 @@ window_procedure :: (hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM): LRE
main :: (argc: int, argv: **char): int
bitmap := create_bitmap({1280, 720})
result := utf8_to_utf32(&"A"[0], 1)
assert(result.out_str == 'A, "Invalid decode")
result = utf8_to_utf32(&"ć"[0], 2)
result = utf8_to_utf32(&"ó"[0], 2)