Skip to content

Commit ce42783

Browse files
author
Robert Schmidtke
committed
fast path was not actually fast
1 parent d34b326 commit ce42783

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

pandas/_libs/src/vendored/numpy/datetime/np_datetime.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,9 @@ PyObject *extract_utc_offset(PyObject *obj) {
340340

341341
static int scaleAndOffset(int64_t timestamp, int64_t scale, int64_t offset,
342342
int64_t *result) {
343-
if (timestamp >= 0) {
344-
// fast path for positive timestamps
345-
if (checked_int64_mul(timestamp, scale, result) != 0) {
346-
return 1;
347-
}
348-
349-
return checked_int64_add(*result, offset, result);
350-
}
351-
352343
// for negative timestamps, scaling could overflow
353344
// even if the scaled and offset timestamp is valid
354-
const int overflow = checked_int64_mul(timestamp, scale, result);
355-
if (overflow != 0) {
345+
if (checked_int64_mul(timestamp, scale, result) != 0) {
356346
// given the current scale, this is the smallest supported timestamp
357347
const int64_t min_scalable_timestamp = (NPY_MIN_INT64 + 1) / scale;
358348

0 commit comments

Comments
 (0)