psycopg.git / summary / log / commit / refs
commit 2d474faad822b248f0e5bf5e8361f1aa96d9b994
Author: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Date: Mon Jun 28 04:31:10 2021 +0000
Fix compatibility with 32 bit platforms
psycopg_c/psycopg_c/types/datetime.pyx | 4 ++--
psycopg_c/psycopg_c/types/numutils.c | 12 +-----------
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/psycopg_c/psycopg_c/types/datetime.pyx b/psycopg_c/psycopg_c/types/datetime.pyx
index 3a04e364..1aa3cb5d 100644
--- a/psycopg_c/psycopg_c/types/datetime.pyx
+++ b/psycopg_c/psycopg_c/types/datetime.pyx
@@ -698,7 +698,7 @@ cdef class TimestampBinaryLoader(CLoader):
cdef object cload(self, const char *data, size_t length):
cdef int64_t val = endian.be64toh((<uint64_t *>data)[0])
- cdef long micros, secs, days
+ cdef int64_t micros, secs, days
# Work only with positive values as the cdivision behaves differently
# with negative values, and cdivision=False adds overhead.
@@ -830,7 +830,7 @@ cdef class TimestamptzBinaryLoader(_BaseTimestamptzLoader):
cdef object cload(self, const char *data, size_t length):
cdef int64_t val = endian.be64toh((<uint64_t *>data)[0])
- cdef long micros, secs, days
+ cdef int64_t micros, secs, days
# Work only with positive values as the cdivision behaves differently
# with negative values, and cdivision=False adds overhead.
diff --git a/psycopg_c/psycopg_c/types/numutils.c b/psycopg_c/psycopg_c/types/numutils.c
index c7de5bef..7847b260 100644
--- a/psycopg_c/psycopg_c/types/numutils.c
+++ b/psycopg_c/psycopg_c/types/numutils.c
@@ -9,17 +9,7 @@
#include <stdint.h>
#include <string.h>
-/* configuration */
-
-#ifdef __GNUC__
-#define SIZEOF_VOID_P __SIZEOF_POINTER__
-#define HAVE__BUILTIN_CLZ 1
-#else
-#error 'you need to define this for your compiler'
-#endif
-
-/* TODO: this is a guess, it is on my Ubuntu 20.04 */
-#define HAVE_LONG_INT_64 1
+#include "pg_config.h"
/*
[parent: 3af2db115149]