Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
kwant
tinyarray
Commits
f4887245
Commit
f4887245
authored
Sep 01, 2020
by
Christoph Groth
Browse files
buffer protocol: support all integer formats
parent
5743ed94
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/array.cc
View file @
f4887245
...
...
@@ -88,7 +88,7 @@ Dtype dtype_of_buffer(Py_buffer *view)
// Currently, we only understand native endianness and alignment.
if
(
*
fmt
==
'@'
)
fmt
++
;
if
(
strchr
(
"cbB?hHiIlL"
,
*
fmt
))
{
if
(
strchr
(
"cbB?hHiIlL
qQnN
"
,
*
fmt
))
{
dtype
=
LONG
;
fmt
++
;
}
else
if
(
strchr
(
"fdg"
,
*
fmt
))
{
...
...
@@ -458,6 +458,10 @@ T (*get_buffer_converter(Py_buffer *view))(const void *)
return
number_from_ptr
<
T
,
long
long
>
;
case
'Q'
:
return
number_from_ptr
<
T
,
unsigned
long
long
>
;
case
'n'
:
return
number_from_ptr
<
T
,
ssize_t
>
;
case
'N'
:
return
number_from_ptr
<
T
,
size_t
>
;
case
'f'
:
return
number_from_ptr
<
T
,
float
>
;
case
'd'
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment