From 9bc22518fb03ebd6f9ce1070a1a9a3b0f0e87b00 Mon Sep 17 00:00:00 2001 From: RoBaertschi Date: Fri, 20 Jun 2025 07:40:18 +0200 Subject: [PATCH] store(ini): little endian and big endian versions --- store/ini.odin | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/store/ini.odin b/store/ini.odin index b38cc08..2c54b89 100644 --- a/store/ini.odin +++ b/store/ini.odin @@ -164,6 +164,8 @@ ini_parse_and_set_pointer_by_base_type :: proc(ptr: rawptr, str: string, type_in case b32: (cast(^b32) ptr)^ = b32(value) case b64: (cast(^b64) ptr)^ = b64(value) } + case runtime.Type_Info_Float: + value := strconv.parse_f64(str) or_return case runtime.Type_Info_Integer: if type_info_variant.signed { value := strconv.parse_i128(str) or_return @@ -174,6 +176,16 @@ ini_parse_and_set_pointer_by_base_type :: proc(ptr: rawptr, str: string, type_in case i32: (cast( ^i32)ptr)^ = cast( i32) bounded_int(value, cast(i128)min( i32), cast(i128)max( i32)) or_return case i64: (cast( ^i64)ptr)^ = cast( i64) bounded_int(value, cast(i128)min( i64), cast(i128)max( i64)) or_return case i128: (cast(^i128)ptr)^ = bounded_int(value, min(i128), max(i128)) or_return + + case i16be: (cast( ^i16be)ptr)^ = cast( i16be) bounded_int(value, cast(i128)min( i16be), cast(i128)max( i16be)) or_return + case i32be: (cast( ^i32be)ptr)^ = cast( i32be) bounded_int(value, cast(i128)min( i32be), cast(i128)max( i32be)) or_return + case i64be: (cast( ^i64be)ptr)^ = cast( i64be) bounded_int(value, cast(i128)min( i64be), cast(i128)max( i64be)) or_return + case i128be: (cast(^i128be)ptr)^ = cast(i128be) bounded_int(value, cast(i128)min(i128be), cast(i128)max(i128be)) or_return + + case i16le: (cast( ^i16le)ptr)^ = cast( i16le) bounded_int(value, cast(i128)min( i16le), cast(i128)max( i16le)) or_return + case i32le: (cast( ^i32le)ptr)^ = cast( i32le) bounded_int(value, cast(i128)min( i32le), cast(i128)max( i32le)) or_return + case i64le: (cast( ^i64le)ptr)^ = cast( i64le) bounded_int(value, cast(i128)min( i64le), cast(i128)max( i64le)) or_return + case i128le: (cast(^i128le)ptr)^ = cast(i128le) bounded_int(value, cast(i128)min(i128le), cast(i128)max(i128le)) or_return } } else { value := strconv.parse_u128(str) or_return @@ -185,6 +197,16 @@ ini_parse_and_set_pointer_by_base_type :: proc(ptr: rawptr, str: string, type_in case u64: (cast( ^u64)ptr)^ = cast( u64) bounded_uint(value, cast(u128)max( u64)) or_return case u128: (cast( ^u128)ptr)^ = bounded_uint(value, max( u128)) or_return case uintptr: (cast(^uintptr)ptr)^ = cast(uintptr) bounded_uint(value, cast(u128)max(uintptr)) or_return + + case u16be: (cast( ^u16be)ptr)^ = cast( u16be) bounded_uint(value, cast(u128)max( u16be)) or_return + case u32be: (cast( ^u32be)ptr)^ = cast( u32be) bounded_uint(value, cast(u128)max( u32be)) or_return + case u64be: (cast( ^u64be)ptr)^ = cast( u64be) bounded_uint(value, cast(u128)max( u64be)) or_return + case u128be: (cast(^u128be)ptr)^ = cast(u128be) bounded_uint(value, cast(u128)max(u128be)) or_return + + case u16le: (cast( ^u16le)ptr)^ = cast( u16le) bounded_uint(value, cast(u128)max( u16le)) or_return + case u32le: (cast( ^u32le)ptr)^ = cast( u32le) bounded_uint(value, cast(u128)max( u32le)) or_return + case u64le: (cast( ^u64le)ptr)^ = cast( u64le) bounded_uint(value, cast(u128)max( u64le)) or_return + case u128le: (cast(^u128le)ptr)^ = cast(u128le) bounded_uint(value, cast(u128)max(u128le)) or_return } } case runtime.Type_Info_String: