Skip to content

Commit ff2cb9a

Browse files
committed
Use proper py_ssize_t min
1 parent 9b3dc2b commit ff2cb9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/isal/isal_zlib.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ctypedef fused stream_or_state:
125125
isal_zstream
126126
inflate_state
127127

128-
cdef unsigned int unsigned_int_min(unsigned int a, unsigned int b):
128+
cdef Py_ssize_t py_ssize_t_min(Py_ssize_t a, Py_ssize_t b):
129129
if a <= b:
130130
return a
131131
else:
@@ -159,7 +159,7 @@ cdef arrange_output_buffer_with_maximum(stream_or_state *stream,
159159
raise MemoryError("Unssufficient memory for buffer allocation")
160160
buffer[0] = new_buffer
161161
length = new_length
162-
stream.avail_out = unsigned_int_min(length - occupied, UINT32_MAX)
162+
stream.avail_out = py_ssize_t_min(length - occupied, UINT32_MAX)
163163
stream.next_out = buffer[0] + occupied
164164
return length
165165

@@ -169,7 +169,7 @@ cdef arrange_output_buffer(stream_or_state *stream, unsigned char **buffer, Py_s
169169
return ret
170170

171171
cdef void arrange_input_buffer(stream_or_state *stream, Py_ssize_t *remains):
172-
stream.avail_in = unsigned_int_min(<unsigned int>remains[0], UINT32_MAX)
172+
stream.avail_in = py_ssize_t_min(remains[0], UINT32_MAX)
173173
remains[0] -= stream.avail_in
174174

175175
def compress(data,

0 commit comments

Comments
 (0)