Răsfoiți Sursa

[compress] 32-bit cleanness.

Jeroen van Rijn 3 ani în urmă
părinte
comite
8af08f2153
2 a modificat fișierele cu 9 adăugiri și 3 ștergeri
  1. 7 1
      core/compress/common.odin
  2. 2 2
      core/compress/gzip/gzip.odin

+ 7 - 1
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,

+ 2 - 2
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
 	}