Skip to content

Commit 0d14c11

Browse files
committed
Use correct types
1 parent 0d9f09c commit 0d14c11

File tree

1 file changed

+50
-52
lines changed

1 file changed

+50
-52
lines changed

src/isal/igzip_lib.pxd

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -163,48 +163,44 @@ cdef extern from "<isa-l/igzip_lib.h>":
163163

164164
cdef struct BitBuf2:
165165
unsigned long long m_bits #!< bits in the bit buffer
166-
unsigned long m_bits_count; #!< number of valid bits in the bit buffer
166+
unsigned int m_bits_count; #!< number of valid bits in the bit buffer
167167
unsigned char *m_out_buff #!< current index of buffer to write to
168168
unsigned char *m_out_end #!< end of buffer to write to
169169
unsigned char *m_out_start #!< start of buffer to write to
170170

171171
cdef struct isal_zstate:
172-
unsigned long total_in_start #!< Not used, may be replaced with something else
173-
unsigned long block_next #!< Start of current deflate block in the input
174-
unsigned long block_end #!< End of current deflate block in the input
175-
unsigned long dist_mask #!< Distance mask used.
176-
unsigned long hash_mask
172+
unsigned int total_in_start #!< Not used, may be replaced with something else
173+
unsigned int block_next #!< Start of current deflate block in the input
174+
unsigned int block_end #!< End of current deflate block in the input
175+
unsigned int dist_mask #!< Distance mask used.
176+
unsigned int hash_mask
177177
isal_zstate_state state #!< Current state in processing the data stream
178178
BitBuf2 bitbuf
179-
unsigned long crc #!< Current checksum without finalize step if any (adler)
179+
unsigned int crc #!< Current checksum without finalize step if any (adler)
180180
unsigned char has_wrap_hdr #!< keeps track of wrapper header
181181
unsigned char has_eob_hdr #!< keeps track of eob on the last deflate block
182182
unsigned char has_hist #!< flag to track if there is match history
183-
unsigned int has_level_buf_init #!< flag to track if user supplied memory has been initialized.
184-
unsigned long count #!< used for partial header/trailer writes
183+
unsigned short has_level_buf_init #!< flag to track if user supplied memory has been initialized.
184+
unsigned int count #!< used for partial header/trailer writes
185185
unsigned char tmp_out_buff[16] #! temporary array
186-
unsigned long tmp_out_start #!< temporary variable
187-
unsigned long tmp_out_end #!< temporary variable
188-
unsigned long b_bytes_valid #!< number of valid bytes in buffer
189-
unsigned long b_bytes_processed #!< number of bytes processed in buffer
190-
# Below values give compile errors because they are dynamic in size
191-
#unsigned char buffer[2 * IGZIP_HIST_SIZE + ISAL_LOOK_AHEAD] #!< Internal buffer
192-
# Stream should be setup such that the head is cache aligned
193-
#unsigned int head[IGZIP_LVL0_HASH_SIZE] #!< Hash array
186+
unsigned int tmp_out_start #!< temporary variable
187+
unsigned int tmp_out_end #!< temporary variable
188+
unsigned int b_bytes_valid #!< number of valid bytes in buffer
189+
unsigned int b_bytes_processed #!< number of bytes processed in buffer
194190

195191
cdef struct isal_hufftables:
196192
pass
197193

198194
cdef struct isal_zstream:
199195
unsigned char *next_in #!< Next input byte
200-
unsigned long avail_in #!< number of bytes available at next_in
201-
unsigned long total_in_start #!< total number of bytes read so far
196+
unsigned int avail_in #!< number of bytes available at next_in
197+
unsigned int total_in_start #!< total number of bytes read so far
202198
unsigned char *next_out #!< Next output byte
203-
unsigned long avail_out #!< number of bytes available at next_out
204-
unsigned long total_out #!< total number of bytes written so far
199+
unsigned int avail_out #!< number of bytes available at next_out
200+
unsigned int total_out #!< total number of bytes written so far
205201
isal_hufftables *hufftables #!< Huffman encoding used when compressing
206-
unsigned long level #!< Compression level to use
207-
unsigned long level_buf_size #!< Size of level_buf
202+
unsigned int level #!< Compression level to use
203+
unsigned int level_buf_size #!< Size of level_buf
208204
unsigned char * level_buf #!< User allocated buffer required for different compression levels
209205
unsigned short end_of_stream #!< non-zero if this is the last input buffer
210206
unsigned short flush #!< Flush type can be NO_FLUSH, SYNC_FLUSH or FULL_FLUSH
@@ -220,19 +216,20 @@ cdef extern from "<isa-l/igzip_lib.h>":
220216

221217
cdef struct inflate_state:
222218
unsigned char *next_out #!< Next output byte
223-
unsigned long avail_out #!< number of bytes available at next_out
224-
unsigned long total_out #!< total number of bytes written so far
219+
unsigned int avail_out #!< number of bytes available at next_out
220+
unsigned int total_out #!< total number of bytes written so far
225221
unsigned char *next_in #!< Next input byte
226-
unsigned long avail_in #!< number of bytes available at next_in
227-
long read_in_length #!< Bits in read_in
222+
unsigned int avail_in #!< number of bytes available at next_in
223+
unsigned long long read_in #!< Bits buffered to handle unaligned streams
224+
int read_in_length #!< Bits in read_in
228225
inflate_huff_code_large lit_huff_code #!< Structure for decoding lit/len symbols
229226
inflate_huff_code_small dist_huff_code #!< Structure for decoding dist symbols
230227
isal_block_state block_state #!< Current decompression state
231-
unsigned long dict_length #!< Length of dictionary used
232-
unsigned long bfinal #!< Flag identifying final block
233-
unsigned long crc_flag #!< Flag identifying whether to track of crc
234-
unsigned long crc #!< Contains crc or adler32 of output if crc_flag is set
235-
unsigned long hist_bits #!< Log base 2 of maximum lookback distance
228+
unsigned int dict_length #!< Length of dictionary used
229+
unsigned int bfinal #!< Flag identifying final block
230+
unsigned int crc_flag #!< Flag identifying whether to track of crc
231+
unsigned int crc #!< Contains crc or adler32 of output if crc_flag is set
232+
unsigned int hist_bits #!< Log base 2 of maximum lookback distance
236233
# Other members are omitted because they are not in use yet.
237234

238235
# Compression functions
@@ -267,7 +264,7 @@ cdef extern from "<isa-l/igzip_lib.h>":
267264
# */
268265
cdef int isal_deflate_set_dict(isal_zstream *stream,
269266
unsigned char *dict,
270-
unsigned long dict_len )
267+
unsigned int dict_len )
271268

272269

273270
#/**
@@ -355,24 +352,6 @@ cdef extern from "<isa-l/igzip_lib.h>":
355352
# */
356353
cdef int isal_deflate_stateless(isal_zstream *stream)
357354

358-
# Other functions
359-
360-
# /**
361-
# * @brief Calculate Adler-32 checksum, runs appropriate version.
362-
# *
363-
# * This function determines what instruction sets are enabled and selects the
364-
# * appropriate version at runtime.
365-
# *
366-
# * @param init: initial Adler-32 value
367-
# * @param buf: buffer to calculate checksum on
368-
# * @param len: buffer length in bytes
369-
# *
370-
# * @returns 32-bit Adler-32 checksum
371-
# */
372-
373-
unsigned long isal_adler32(unsigned long init,
374-
const unsigned char *buf,
375-
unsigned long long len)
376355

377356
###########################
378357
# Inflate functions
@@ -406,7 +385,7 @@ cdef extern from "<isa-l/igzip_lib.h>":
406385
# * @returns COMP_OK,
407386
# * ISAL_INVALID_STATE (dictionary could not be set)
408387
# */
409-
int isal_inflate_set_dict(inflate_state *state, unsigned char *dict, unsigned long dict_len)
388+
int isal_inflate_set_dict(inflate_state *state, unsigned char *dict, unsigned int dict_len)
410389

411390
# /**
412391
# * @brief Fast data (deflate) decompression for storage applications.
@@ -454,3 +433,22 @@ cdef extern from "<isa-l/igzip_lib.h>":
454433
# * ISAL_INCORRECT_CHECKSUM.
455434
# */
456435
int isal_inflate(inflate_state *state)
436+
437+
##########################
438+
# Other functions
439+
##########################
440+
# /**
441+
# * @brief Calculate Adler-32 checksum, runs appropriate version.
442+
# *
443+
# * This function determines what instruction sets are enabled and selects the
444+
# * appropriate version at runtime.
445+
# *
446+
# * @param init: initial Adler-32 value
447+
# * @param buf: buffer to calculate checksum on
448+
# * @param len: buffer length in bytes
449+
# *
450+
# * @returns 32-bit Adler-32 checksum
451+
# */
452+
unsigned long isal_adler32(unsigned int init,
453+
const unsigned char *buf,
454+
unsigned long long len)

0 commit comments

Comments
 (0)