-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace bytes of compressed stream with uint8_t #106
Changes from 8 commits
2361be0
3479dd7
b737a9b
14131c3
470b0f5
ebd227e
d87759c
01a5a97
0a730b8
c1e444e
07022fd
0f74a36
b3bc658
219f0ce
b4c96fb
1a65860
f084835
bd0e413
0583611
fdde60b
f1709a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,6 +5,7 @@ import cython | |||||
from libc.stdlib cimport malloc, free | ||||||
from cython cimport view | ||||||
from cpython cimport array | ||||||
from libc.stdint cimport uint8_t | ||||||
import array | ||||||
|
||||||
import itertools | ||||||
|
@@ -245,7 +246,7 @@ cdef _validate_4d_list(in_list, list_name): | |||||
) | ||||||
|
||||||
cpdef np.ndarray _decompress( | ||||||
bytes compressed_data, | ||||||
const uint8_t[::1] compressed_data, | ||||||
zfp_type ztype, | ||||||
shape, | ||||||
out=None, | ||||||
|
@@ -260,10 +261,10 @@ cpdef np.ndarray _decompress( | |||||
raise ValueError("Cannot decompress in-place") | ||||||
_validate_4d_list(shape, "shape") | ||||||
|
||||||
cdef char* comp_data_pointer = compressed_data | ||||||
cdef const char* comp_data_pointer = <const char*>&compressed_data[0] | ||||||
cdef zfp_field* field = zfp_field_alloc() | ||||||
cdef bitstream* bstream = stream_open( | ||||||
comp_data_pointer, | ||||||
<void *>comp_data_pointer, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this second cast from |
||||||
len(compressed_data) | ||||||
) | ||||||
cdef zfp_stream* stream = zfp_stream_open(bstream) | ||||||
|
@@ -329,15 +330,15 @@ cpdef np.ndarray _decompress( | |||||
return output | ||||||
|
||||||
cpdef np.ndarray decompress_numpy( | ||||||
bytes compressed_data, | ||||||
const uint8_t[::1] compressed_data, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry there may have been an extra space in the suggestion before. Maybe that helps?
Suggested change
|
||||||
): | ||||||
if compressed_data is None: | ||||||
raise TypeError("compressed_data cannot be None") | ||||||
|
||||||
cdef char* comp_data_pointer = compressed_data | ||||||
cdef const char* comp_data_pointer = <const char *>&compressed_data[0] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here; |
||||||
cdef zfp_field* field = zfp_field_alloc() | ||||||
cdef bitstream* bstream = stream_open( | ||||||
comp_data_pointer, | ||||||
<void *>comp_data_pointer, | ||||||
len(compressed_data) | ||||||
) | ||||||
cdef zfp_stream* stream = zfp_stream_open(bstream) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please change this to
const void*
to avoid any confusion why the pointer is initially cast to a (signed)char*
?