Skip to content

Commit 263aea6

Browse files
committed
Simplify condition
1 parent 4b24773 commit 263aea6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pandas/io/sas/sas.pyx

+5-6
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ cdef class Parser:
415415

416416
cdef:
417417
Py_ssize_t j
418-
int s, k, m, jb, js, current_row, rpos
418+
int k, m, jb, js, current_row, rpos
419419
int64_t lngt, start, ct
420420
Buffer source, decompressed_source
421421
int64_t[:] column_types
@@ -444,7 +444,6 @@ cdef class Parser:
444444
offsets = self.offsets
445445
byte_chunk = self.byte_chunk
446446
string_chunk = self.string_chunk
447-
s = 8 * self.current_row_in_chunk_index
448447
js = 0
449448
jb = 0
450449
for j in range(self.column_count):
@@ -455,10 +454,10 @@ cdef class Parser:
455454
ct = column_types[j]
456455
if ct == column_type_decimal:
457456
# decimal
458-
if self.is_little_endian:
459-
m = s + 8 - lngt
460-
else:
461-
m = s
457+
assert lngt in (4, 8)
458+
m = 8 * self.current_row_in_chunk_index
459+
if lngt == 4 and self.is_little_endian:
460+
m += 4
462461
for k in range(lngt):
463462
byte_chunk[jb, m + k] = buf_get(source, start + k)
464463
jb += 1

0 commit comments

Comments
 (0)