From 8af08f2153294174075b569e81f421a2efd4b183 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Thu, 3 Mar 2022 15:10:19 +0100 Subject: [PATCH] [compress] 32-bit cleanness. --- core/compress/common.odin | 8 +++++++- core/compress/gzip/gzip.odin | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/compress/common.odin b/core/compress/common.odin index 5f5ef2413..8bc7d240d 100644 --- a/core/compress/common.odin +++ b/core/compress/common.odin @@ -139,7 +139,13 @@ Context_Memory_Input :: struct #packed { size_packed: i64, size_unpacked: i64, } -#assert(size_of(Context_Memory_Input) == 64) +when size_of(rawptr) == 8 { + #assert(size_of(Context_Memory_Input) == 64) +} else { + // e.g. `-target:windows_386` + #assert(size_of(Context_Memory_Input) == 52) +} + Context_Stream_Input :: struct #packed { input_data: []u8, diff --git a/core/compress/gzip/gzip.odin b/core/compress/gzip/gzip.odin index 96e9c49a0..4482d4a7e 100644 --- a/core/compress/gzip/gzip.odin +++ b/core/compress/gzip/gzip.odin @@ -100,7 +100,7 @@ E_GZIP :: compress.GZIP_Error E_ZLIB :: compress.ZLIB_Error E_Deflate :: compress.Deflate_Error -GZIP_MAX_PAYLOAD_SIZE :: int(max(u32le)) +GZIP_MAX_PAYLOAD_SIZE :: i64(max(u32le)) load :: proc{load_from_slice, load_from_file, load_from_context} @@ -136,7 +136,7 @@ load_from_context :: proc(z: ^$C, buf: ^bytes.Buffer, known_gzip_size := -1, exp z.output = buf - if expected_output_size > GZIP_MAX_PAYLOAD_SIZE { + if i64(expected_output_size) > i64(GZIP_MAX_PAYLOAD_SIZE) { return E_GZIP.Payload_Size_Exceeds_Max_Payload }