From f5de4b56dc85ad5d7381e72a9dd4eaab199be630 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 27 Nov 2016 22:15:06 -0800 Subject: [PATCH] use proper fixed width types fixes checksumming when compiling for 64-bit --- Yaz0_fast.pyx | 5 +++-- n64_fast.pyx | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Yaz0_fast.pyx b/Yaz0_fast.pyx index ae129ad..22c162b 100644 --- a/Yaz0_fast.pyx +++ b/Yaz0_fast.pyx @@ -1,7 +1,8 @@ # decoder ripped from: http://www.amnoid.de/gc/yaz0.txt -ctypedef unsigned long ulong -ctypedef unsigned char uchar +from libc.stdint cimport uint32_t, uint8_t +ctypedef uint32_t ulong +ctypedef uint8_t uchar cdef ulong get_size(uchar *comp): return comp[4]*0x1000000 + comp[5]*0x10000 + comp[6]*0x100 + comp[7] diff --git a/n64_fast.pyx b/n64_fast.pyx index ad7040b..6463dd2 100644 --- a/n64_fast.pyx +++ b/n64_fast.pyx @@ -1,11 +1,9 @@ # Based on uCON64's N64 checksum algorithm by Andreas Sterbenz -ctypedef unsigned long ulong -ctypedef unsigned char uchar - +from libc.stdint cimport uint32_t, uint8_t # ulong must be 32 bits since we expect them to overflow as such -# TODO: test on different machines -assert(sizeof(ulong) == 4) +ctypedef uint32_t ulong +ctypedef uint8_t uchar from zlib import crc32