Skip to content

Commit

Permalink
Move the Python 2 character array case first
Browse files Browse the repository at this point in the history
This makes it a little easier to read the code either in Cython or its C
equivalent.
  • Loading branch information
jakirkham committed Nov 24, 2018
1 parent 3eeb27d commit 96bbe67
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cybuffer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ cdef class cybuffer(object):

# Cast to appropriate format
fmt = self._format[0]
if fmt == 'u' or fmt == 'w':
if PY2K and fmt == 'c':
self._format = UINT8_TC
elif fmt == 'u' or fmt == 'w':
if self.itemsize == 2:
self._format = UINT16_TC
elif self.itemsize == 4:
self._format = UINT32_TC
elif PY2K and fmt == 'c':
self._format = UINT8_TC

# Adjust shape and strides based on casting
if PY2K and self.itemsize != 1:
Expand Down

0 comments on commit 96bbe67

Please sign in to comment.