Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
b0539cbc
Commit
b0539cbc
authored
Aug 10, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 'c' rather than 'b' for buffer format of chars.
parent
5de843ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+5
-2
Cython/Utility/Buffer.c
Cython/Utility/Buffer.c
+9
-3
No files found.
Cython/Compiler/Buffer.py
View file @
b0539cbc
...
...
@@ -681,7 +681,10 @@ def get_type_information_cname(code, dtype, maxdepth=None):
flags
=
"0"
is_unsigned
=
"0"
if
dtype
.
is_int
:
if
dtype
is
PyrexTypes
.
c_char_type
:
is_unsigned
=
"IS_UNSIGNED(%s)"
%
declcode
typegroup
=
"'H'"
elif
dtype
.
is_int
:
is_unsigned
=
"IS_UNSIGNED(%s)"
%
declcode
typegroup
=
"%s ? 'U' : 'I'"
%
is_unsigned
elif
complex_possible
or
dtype
.
is_complex
:
...
...
@@ -695,7 +698,7 @@ def get_type_information_cname(code, dtype, maxdepth=None):
elif
dtype
.
is_pyobject
:
typegroup
=
"'O'"
else
:
assert
False
assert
False
,
dtype
typeinfo
=
(
'static __Pyx_TypeInfo %s = '
'{ "%s", %s, sizeof(%s), { %s }, %s, %s, %s, %s };'
)
...
...
Cython/Utility/Buffer.c
View file @
b0539cbc
...
...
@@ -66,7 +66,7 @@ typedef struct {
size_t
size
;
/* sizeof(type) */
size_t
arraysize
[
8
];
/* length of array in each dimension */
int
ndim
;
char
typegroup
;
/* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
char
typegroup
;
/* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject
, c_H_ar
*/
char
is_unsigned
;
int
flags
;
}
__Pyx_TypeInfo
;
...
...
@@ -290,7 +290,8 @@ static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
static
const
char
*
__Pyx_BufFmt_DescribeTypeChar
(
char
ch
,
int
is_complex
)
{
switch
(
ch
)
{
case
'b'
:
return
"'char'"
;
case
'c'
:
return
"'char'"
;
case
'b'
:
return
"'signed char'"
;
case
'B'
:
return
"'unsigned char'"
;
case
'h'
:
return
"'short'"
;
case
'H'
:
return
"'unsigned short'"
;
...
...
@@ -417,7 +418,9 @@ static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_compl
static
char
__Pyx_BufFmt_TypeCharToGroup
(
char
ch
,
int
is_complex
)
{
switch
(
ch
)
{
case
'c'
:
case
'b'
:
case
'h'
:
case
'i'
:
case
'c'
:
return
'H'
;
case
'b'
:
case
'h'
:
case
'i'
:
case
'l'
:
case
'q'
:
case
's'
:
case
'p'
:
return
'I'
;
case
'B'
:
case
'H'
:
case
'I'
:
case
'L'
:
case
'Q'
:
...
...
@@ -893,6 +896,9 @@ static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type)
size_t
size
=
type
->
size
;
switch
(
type
->
typegroup
)
{
case
'H'
:
*
buf
=
'c'
;
break
;
case
'I'
:
case
'U'
:
if
(
size
==
1
)
...
...
Write
Preview
Markdown
is supported
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