|
0 |
/* Generated by Cython 0.29.21 */
|
|
1 |
|
|
2 |
/* BEGIN: Cython Metadata
|
|
3 |
{
|
|
4 |
"distutils": {
|
|
5 |
"depends": [],
|
|
6 |
"name": "clickhouse_driver.columns.largeint",
|
|
7 |
"sources": [
|
|
8 |
"clickhouse_driver/columns/largeint.pyx"
|
|
9 |
]
|
|
10 |
},
|
|
11 |
"module_name": "clickhouse_driver.columns.largeint"
|
|
12 |
}
|
|
13 |
END: Cython Metadata */
|
|
14 |
|
|
15 |
#define PY_SSIZE_T_CLEAN
|
|
16 |
#include "Python.h"
|
|
17 |
#ifndef Py_PYTHON_H
|
|
18 |
#error Python headers needed to compile C extensions, please install development version of Python.
|
|
19 |
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
|
|
20 |
#error Cython requires Python 2.6+ or Python 3.3+.
|
|
21 |
#else
|
|
22 |
#define CYTHON_ABI "0_29_21"
|
|
23 |
#define CYTHON_HEX_VERSION 0x001D15F0
|
|
24 |
#define CYTHON_FUTURE_DIVISION 1
|
|
25 |
#include <stddef.h>
|
|
26 |
#ifndef offsetof
|
|
27 |
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
|
|
28 |
#endif
|
|
29 |
#if !defined(WIN32) && !defined(MS_WINDOWS)
|
|
30 |
#ifndef __stdcall
|
|
31 |
#define __stdcall
|
|
32 |
#endif
|
|
33 |
#ifndef __cdecl
|
|
34 |
#define __cdecl
|
|
35 |
#endif
|
|
36 |
#ifndef __fastcall
|
|
37 |
#define __fastcall
|
|
38 |
#endif
|
|
39 |
#endif
|
|
40 |
#ifndef DL_IMPORT
|
|
41 |
#define DL_IMPORT(t) t
|
|
42 |
#endif
|
|
43 |
#ifndef DL_EXPORT
|
|
44 |
#define DL_EXPORT(t) t
|
|
45 |
#endif
|
|
46 |
#define __PYX_COMMA ,
|
|
47 |
#ifndef HAVE_LONG_LONG
|
|
48 |
#if PY_VERSION_HEX >= 0x02070000
|
|
49 |
#define HAVE_LONG_LONG
|
|
50 |
#endif
|
|
51 |
#endif
|
|
52 |
#ifndef PY_LONG_LONG
|
|
53 |
#define PY_LONG_LONG LONG_LONG
|
|
54 |
#endif
|
|
55 |
#ifndef Py_HUGE_VAL
|
|
56 |
#define Py_HUGE_VAL HUGE_VAL
|
|
57 |
#endif
|
|
58 |
#ifdef PYPY_VERSION
|
|
59 |
#define CYTHON_COMPILING_IN_PYPY 1
|
|
60 |
#define CYTHON_COMPILING_IN_PYSTON 0
|
|
61 |
#define CYTHON_COMPILING_IN_CPYTHON 0
|
|
62 |
#undef CYTHON_USE_TYPE_SLOTS
|
|
63 |
#define CYTHON_USE_TYPE_SLOTS 0
|
|
64 |
#undef CYTHON_USE_PYTYPE_LOOKUP
|
|
65 |
#define CYTHON_USE_PYTYPE_LOOKUP 0
|
|
66 |
#if PY_VERSION_HEX < 0x03050000
|
|
67 |
#undef CYTHON_USE_ASYNC_SLOTS
|
|
68 |
#define CYTHON_USE_ASYNC_SLOTS 0
|
|
69 |
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
|
|
70 |
#define CYTHON_USE_ASYNC_SLOTS 1
|
|
71 |
#endif
|
|
72 |
#undef CYTHON_USE_PYLIST_INTERNALS
|
|
73 |
#define CYTHON_USE_PYLIST_INTERNALS 0
|
|
74 |
#undef CYTHON_USE_UNICODE_INTERNALS
|
|
75 |
#define CYTHON_USE_UNICODE_INTERNALS 0
|
|
76 |
#undef CYTHON_USE_UNICODE_WRITER
|
|
77 |
#define CYTHON_USE_UNICODE_WRITER 0
|
|
78 |
#undef CYTHON_USE_PYLONG_INTERNALS
|
|
79 |
#define CYTHON_USE_PYLONG_INTERNALS 0
|
|
80 |
#undef CYTHON_AVOID_BORROWED_REFS
|
|
81 |
#define CYTHON_AVOID_BORROWED_REFS 1
|
|
82 |
#undef CYTHON_ASSUME_SAFE_MACROS
|
|
83 |
#define CYTHON_ASSUME_SAFE_MACROS 0
|
|
84 |
#undef CYTHON_UNPACK_METHODS
|
|
85 |
#define CYTHON_UNPACK_METHODS 0
|
|
86 |
#undef CYTHON_FAST_THREAD_STATE
|
|
87 |
#define CYTHON_FAST_THREAD_STATE 0
|
|
88 |
#undef CYTHON_FAST_PYCALL
|
|
89 |
#define CYTHON_FAST_PYCALL 0
|
|
90 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT
|
|
91 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
|
|
92 |
#undef CYTHON_USE_TP_FINALIZE
|
|
93 |
#define CYTHON_USE_TP_FINALIZE 0
|
|
94 |
#undef CYTHON_USE_DICT_VERSIONS
|
|
95 |
#define CYTHON_USE_DICT_VERSIONS 0
|
|
96 |
#undef CYTHON_USE_EXC_INFO_STACK
|
|
97 |
#define CYTHON_USE_EXC_INFO_STACK 0
|
|
98 |
#elif defined(PYSTON_VERSION)
|
|
99 |
#define CYTHON_COMPILING_IN_PYPY 0
|
|
100 |
#define CYTHON_COMPILING_IN_PYSTON 1
|
|
101 |
#define CYTHON_COMPILING_IN_CPYTHON 0
|
|
102 |
#ifndef CYTHON_USE_TYPE_SLOTS
|
|
103 |
#define CYTHON_USE_TYPE_SLOTS 1
|
|
104 |
#endif
|
|
105 |
#undef CYTHON_USE_PYTYPE_LOOKUP
|
|
106 |
#define CYTHON_USE_PYTYPE_LOOKUP 0
|
|
107 |
#undef CYTHON_USE_ASYNC_SLOTS
|
|
108 |
#define CYTHON_USE_ASYNC_SLOTS 0
|
|
109 |
#undef CYTHON_USE_PYLIST_INTERNALS
|
|
110 |
#define CYTHON_USE_PYLIST_INTERNALS 0
|
|
111 |
#ifndef CYTHON_USE_UNICODE_INTERNALS
|
|
112 |
#define CYTHON_USE_UNICODE_INTERNALS 1
|
|
113 |
#endif
|
|
114 |
#undef CYTHON_USE_UNICODE_WRITER
|
|
115 |
#define CYTHON_USE_UNICODE_WRITER 0
|
|
116 |
#undef CYTHON_USE_PYLONG_INTERNALS
|
|
117 |
#define CYTHON_USE_PYLONG_INTERNALS 0
|
|
118 |
#ifndef CYTHON_AVOID_BORROWED_REFS
|
|
119 |
#define CYTHON_AVOID_BORROWED_REFS 0
|
|
120 |
#endif
|
|
121 |
#ifndef CYTHON_ASSUME_SAFE_MACROS
|
|
122 |
#define CYTHON_ASSUME_SAFE_MACROS 1
|
|
123 |
#endif
|
|
124 |
#ifndef CYTHON_UNPACK_METHODS
|
|
125 |
#define CYTHON_UNPACK_METHODS 1
|
|
126 |
#endif
|
|
127 |
#undef CYTHON_FAST_THREAD_STATE
|
|
128 |
#define CYTHON_FAST_THREAD_STATE 0
|
|
129 |
#undef CYTHON_FAST_PYCALL
|
|
130 |
#define CYTHON_FAST_PYCALL 0
|
|
131 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT
|
|
132 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0
|
|
133 |
#undef CYTHON_USE_TP_FINALIZE
|
|
134 |
#define CYTHON_USE_TP_FINALIZE 0
|
|
135 |
#undef CYTHON_USE_DICT_VERSIONS
|
|
136 |
#define CYTHON_USE_DICT_VERSIONS 0
|
|
137 |
#undef CYTHON_USE_EXC_INFO_STACK
|
|
138 |
#define CYTHON_USE_EXC_INFO_STACK 0
|
|
139 |
#else
|
|
140 |
#define CYTHON_COMPILING_IN_PYPY 0
|
|
141 |
#define CYTHON_COMPILING_IN_PYSTON 0
|
|
142 |
#define CYTHON_COMPILING_IN_CPYTHON 1
|
|
143 |
#ifndef CYTHON_USE_TYPE_SLOTS
|
|
144 |
#define CYTHON_USE_TYPE_SLOTS 1
|
|
145 |
#endif
|
|
146 |
#if PY_VERSION_HEX < 0x02070000
|
|
147 |
#undef CYTHON_USE_PYTYPE_LOOKUP
|
|
148 |
#define CYTHON_USE_PYTYPE_LOOKUP 0
|
|
149 |
#elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
|
|
150 |
#define CYTHON_USE_PYTYPE_LOOKUP 1
|
|
151 |
#endif
|
|
152 |
#if PY_MAJOR_VERSION < 3
|
|
153 |
#undef CYTHON_USE_ASYNC_SLOTS
|
|
154 |
#define CYTHON_USE_ASYNC_SLOTS 0
|
|
155 |
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
|
|
156 |
#define CYTHON_USE_ASYNC_SLOTS 1
|
|
157 |
#endif
|
|
158 |
#if PY_VERSION_HEX < 0x02070000
|
|
159 |
#undef CYTHON_USE_PYLONG_INTERNALS
|
|
160 |
#define CYTHON_USE_PYLONG_INTERNALS 0
|
|
161 |
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
|
|
162 |
#define CYTHON_USE_PYLONG_INTERNALS 1
|
|
163 |
#endif
|
|
164 |
#ifndef CYTHON_USE_PYLIST_INTERNALS
|
|
165 |
#define CYTHON_USE_PYLIST_INTERNALS 1
|
|
166 |
#endif
|
|
167 |
#ifndef CYTHON_USE_UNICODE_INTERNALS
|
|
168 |
#define CYTHON_USE_UNICODE_INTERNALS 1
|
|
169 |
#endif
|
|
170 |
#if PY_VERSION_HEX < 0x030300F0
|
|
171 |
#undef CYTHON_USE_UNICODE_WRITER
|
|
172 |
#define CYTHON_USE_UNICODE_WRITER 0
|
|
173 |
#elif !defined(CYTHON_USE_UNICODE_WRITER)
|
|
174 |
#define CYTHON_USE_UNICODE_WRITER 1
|
|
175 |
#endif
|
|
176 |
#ifndef CYTHON_AVOID_BORROWED_REFS
|
|
177 |
#define CYTHON_AVOID_BORROWED_REFS 0
|
|
178 |
#endif
|
|
179 |
#ifndef CYTHON_ASSUME_SAFE_MACROS
|
|
180 |
#define CYTHON_ASSUME_SAFE_MACROS 1
|
|
181 |
#endif
|
|
182 |
#ifndef CYTHON_UNPACK_METHODS
|
|
183 |
#define CYTHON_UNPACK_METHODS 1
|
|
184 |
#endif
|
|
185 |
#ifndef CYTHON_FAST_THREAD_STATE
|
|
186 |
#define CYTHON_FAST_THREAD_STATE 1
|
|
187 |
#endif
|
|
188 |
#ifndef CYTHON_FAST_PYCALL
|
|
189 |
#define CYTHON_FAST_PYCALL 1
|
|
190 |
#endif
|
|
191 |
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT
|
|
192 |
#define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
|
|
193 |
#endif
|
|
194 |
#ifndef CYTHON_USE_TP_FINALIZE
|
|
195 |
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
|
|
196 |
#endif
|
|
197 |
#ifndef CYTHON_USE_DICT_VERSIONS
|
|
198 |
#define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
|
|
199 |
#endif
|
|
200 |
#ifndef CYTHON_USE_EXC_INFO_STACK
|
|
201 |
#define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
|
|
202 |
#endif
|
|
203 |
#endif
|
|
204 |
#if !defined(CYTHON_FAST_PYCCALL)
|
|
205 |
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
|
|
206 |
#endif
|
|
207 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
208 |
#include "longintrepr.h"
|
|
209 |
#undef SHIFT
|
|
210 |
#undef BASE
|
|
211 |
#undef MASK
|
|
212 |
#ifdef SIZEOF_VOID_P
|
|
213 |
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
|
|
214 |
#endif
|
|
215 |
#endif
|
|
216 |
#ifndef __has_attribute
|
|
217 |
#define __has_attribute(x) 0
|
|
218 |
#endif
|
|
219 |
#ifndef __has_cpp_attribute
|
|
220 |
#define __has_cpp_attribute(x) 0
|
|
221 |
#endif
|
|
222 |
#ifndef CYTHON_RESTRICT
|
|
223 |
#if defined(__GNUC__)
|
|
224 |
#define CYTHON_RESTRICT __restrict__
|
|
225 |
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
|
226 |
#define CYTHON_RESTRICT __restrict
|
|
227 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
228 |
#define CYTHON_RESTRICT restrict
|
|
229 |
#else
|
|
230 |
#define CYTHON_RESTRICT
|
|
231 |
#endif
|
|
232 |
#endif
|
|
233 |
#ifndef CYTHON_UNUSED
|
|
234 |
# if defined(__GNUC__)
|
|
235 |
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
|
236 |
# define CYTHON_UNUSED __attribute__ ((__unused__))
|
|
237 |
# else
|
|
238 |
# define CYTHON_UNUSED
|
|
239 |
# endif
|
|
240 |
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
|
|
241 |
# define CYTHON_UNUSED __attribute__ ((__unused__))
|
|
242 |
# else
|
|
243 |
# define CYTHON_UNUSED
|
|
244 |
# endif
|
|
245 |
#endif
|
|
246 |
#ifndef CYTHON_MAYBE_UNUSED_VAR
|
|
247 |
# if defined(__cplusplus)
|
|
248 |
template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
|
|
249 |
# else
|
|
250 |
# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
|
|
251 |
# endif
|
|
252 |
#endif
|
|
253 |
#ifndef CYTHON_NCP_UNUSED
|
|
254 |
# if CYTHON_COMPILING_IN_CPYTHON
|
|
255 |
# define CYTHON_NCP_UNUSED
|
|
256 |
# else
|
|
257 |
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
|
|
258 |
# endif
|
|
259 |
#endif
|
|
260 |
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
|
|
261 |
#ifdef _MSC_VER
|
|
262 |
#ifndef _MSC_STDINT_H_
|
|
263 |
#if _MSC_VER < 1300
|
|
264 |
typedef unsigned char uint8_t;
|
|
265 |
typedef unsigned int uint32_t;
|
|
266 |
#else
|
|
267 |
typedef unsigned __int8 uint8_t;
|
|
268 |
typedef unsigned __int32 uint32_t;
|
|
269 |
#endif
|
|
270 |
#endif
|
|
271 |
#else
|
|
272 |
#include <stdint.h>
|
|
273 |
#endif
|
|
274 |
#ifndef CYTHON_FALLTHROUGH
|
|
275 |
#if defined(__cplusplus) && __cplusplus >= 201103L
|
|
276 |
#if __has_cpp_attribute(fallthrough)
|
|
277 |
#define CYTHON_FALLTHROUGH [[fallthrough]]
|
|
278 |
#elif __has_cpp_attribute(clang::fallthrough)
|
|
279 |
#define CYTHON_FALLTHROUGH [[clang::fallthrough]]
|
|
280 |
#elif __has_cpp_attribute(gnu::fallthrough)
|
|
281 |
#define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
|
|
282 |
#endif
|
|
283 |
#endif
|
|
284 |
#ifndef CYTHON_FALLTHROUGH
|
|
285 |
#if __has_attribute(fallthrough)
|
|
286 |
#define CYTHON_FALLTHROUGH __attribute__((fallthrough))
|
|
287 |
#else
|
|
288 |
#define CYTHON_FALLTHROUGH
|
|
289 |
#endif
|
|
290 |
#endif
|
|
291 |
#if defined(__clang__ ) && defined(__apple_build_version__)
|
|
292 |
#if __apple_build_version__ < 7000000
|
|
293 |
#undef CYTHON_FALLTHROUGH
|
|
294 |
#define CYTHON_FALLTHROUGH
|
|
295 |
#endif
|
|
296 |
#endif
|
|
297 |
#endif
|
|
298 |
|
|
299 |
#ifndef CYTHON_INLINE
|
|
300 |
#if defined(__clang__)
|
|
301 |
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
|
|
302 |
#elif defined(__GNUC__)
|
|
303 |
#define CYTHON_INLINE __inline__
|
|
304 |
#elif defined(_MSC_VER)
|
|
305 |
#define CYTHON_INLINE __inline
|
|
306 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
307 |
#define CYTHON_INLINE inline
|
|
308 |
#else
|
|
309 |
#define CYTHON_INLINE
|
|
310 |
#endif
|
|
311 |
#endif
|
|
312 |
|
|
313 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
|
|
314 |
#define Py_OptimizeFlag 0
|
|
315 |
#endif
|
|
316 |
#define __PYX_BUILD_PY_SSIZE_T "n"
|
|
317 |
#define CYTHON_FORMAT_SSIZE_T "z"
|
|
318 |
#if PY_MAJOR_VERSION < 3
|
|
319 |
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
|
|
320 |
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
|
|
321 |
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
|
|
322 |
#define __Pyx_DefaultClassType PyClass_Type
|
|
323 |
#else
|
|
324 |
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
|
|
325 |
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
|
|
326 |
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
|
|
327 |
PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
|
|
328 |
#else
|
|
329 |
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
|
|
330 |
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
|
|
331 |
#endif
|
|
332 |
#define __Pyx_DefaultClassType PyType_Type
|
|
333 |
#endif
|
|
334 |
#ifndef Py_TPFLAGS_CHECKTYPES
|
|
335 |
#define Py_TPFLAGS_CHECKTYPES 0
|
|
336 |
#endif
|
|
337 |
#ifndef Py_TPFLAGS_HAVE_INDEX
|
|
338 |
#define Py_TPFLAGS_HAVE_INDEX 0
|
|
339 |
#endif
|
|
340 |
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
|
|
341 |
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
|
|
342 |
#endif
|
|
343 |
#ifndef Py_TPFLAGS_HAVE_FINALIZE
|
|
344 |
#define Py_TPFLAGS_HAVE_FINALIZE 0
|
|
345 |
#endif
|
|
346 |
#ifndef METH_STACKLESS
|
|
347 |
#define METH_STACKLESS 0
|
|
348 |
#endif
|
|
349 |
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
|
|
350 |
#ifndef METH_FASTCALL
|
|
351 |
#define METH_FASTCALL 0x80
|
|
352 |
#endif
|
|
353 |
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
|
|
354 |
typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
|
|
355 |
Py_ssize_t nargs, PyObject *kwnames);
|
|
356 |
#else
|
|
357 |
#define __Pyx_PyCFunctionFast _PyCFunctionFast
|
|
358 |
#define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
|
|
359 |
#endif
|
|
360 |
#if CYTHON_FAST_PYCCALL
|
|
361 |
#define __Pyx_PyFastCFunction_Check(func)\
|
|
362 |
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
|
|
363 |
#else
|
|
364 |
#define __Pyx_PyFastCFunction_Check(func) 0
|
|
365 |
#endif
|
|
366 |
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
|
|
367 |
#define PyObject_Malloc(s) PyMem_Malloc(s)
|
|
368 |
#define PyObject_Free(p) PyMem_Free(p)
|
|
369 |
#define PyObject_Realloc(p) PyMem_Realloc(p)
|
|
370 |
#endif
|
|
371 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
|
|
372 |
#define PyMem_RawMalloc(n) PyMem_Malloc(n)
|
|
373 |
#define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
|
|
374 |
#define PyMem_RawFree(p) PyMem_Free(p)
|
|
375 |
#endif
|
|
376 |
#if CYTHON_COMPILING_IN_PYSTON
|
|
377 |
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
|
|
378 |
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
|
|
379 |
#else
|
|
380 |
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
|
|
381 |
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
|
|
382 |
#endif
|
|
383 |
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
|
|
384 |
#define __Pyx_PyThreadState_Current PyThreadState_GET()
|
|
385 |
#elif PY_VERSION_HEX >= 0x03060000
|
|
386 |
#define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
|
|
387 |
#elif PY_VERSION_HEX >= 0x03000000
|
|
388 |
#define __Pyx_PyThreadState_Current PyThreadState_GET()
|
|
389 |
#else
|
|
390 |
#define __Pyx_PyThreadState_Current _PyThreadState_Current
|
|
391 |
#endif
|
|
392 |
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
|
|
393 |
#include "pythread.h"
|
|
394 |
#define Py_tss_NEEDS_INIT 0
|
|
395 |
typedef int Py_tss_t;
|
|
396 |
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
|
|
397 |
*key = PyThread_create_key();
|
|
398 |
return 0;
|
|
399 |
}
|
|
400 |
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
|
|
401 |
Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
|
|
402 |
*key = Py_tss_NEEDS_INIT;
|
|
403 |
return key;
|
|
404 |
}
|
|
405 |
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
|
|
406 |
PyObject_Free(key);
|
|
407 |
}
|
|
408 |
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
|
|
409 |
return *key != Py_tss_NEEDS_INIT;
|
|
410 |
}
|
|
411 |
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
|
|
412 |
PyThread_delete_key(*key);
|
|
413 |
*key = Py_tss_NEEDS_INIT;
|
|
414 |
}
|
|
415 |
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
|
|
416 |
return PyThread_set_key_value(*key, value);
|
|
417 |
}
|
|
418 |
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
|
|
419 |
return PyThread_get_key_value(*key);
|
|
420 |
}
|
|
421 |
#endif
|
|
422 |
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
|
|
423 |
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
|
|
424 |
#else
|
|
425 |
#define __Pyx_PyDict_NewPresized(n) PyDict_New()
|
|
426 |
#endif
|
|
427 |
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
|
|
428 |
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
|
|
429 |
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
|
|
430 |
#else
|
|
431 |
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
|
|
432 |
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
|
|
433 |
#endif
|
|
434 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
|
|
435 |
#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
|
|
436 |
#else
|
|
437 |
#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
|
|
438 |
#endif
|
|
439 |
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
|
|
440 |
#define CYTHON_PEP393_ENABLED 1
|
|
441 |
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
|
|
442 |
0 : _PyUnicode_Ready((PyObject *)(op)))
|
|
443 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
|
|
444 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
|
|
445 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
|
|
446 |
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
|
|
447 |
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
|
|
448 |
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
|
|
449 |
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
|
|
450 |
#if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
|
|
451 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
|
|
452 |
#else
|
|
453 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
|
|
454 |
#endif
|
|
455 |
#else
|
|
456 |
#define CYTHON_PEP393_ENABLED 0
|
|
457 |
#define PyUnicode_1BYTE_KIND 1
|
|
458 |
#define PyUnicode_2BYTE_KIND 2
|
|
459 |
#define PyUnicode_4BYTE_KIND 4
|
|
460 |
#define __Pyx_PyUnicode_READY(op) (0)
|
|
461 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
|
|
462 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
|
|
463 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
|
|
464 |
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
|
|
465 |
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
|
|
466 |
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
|
|
467 |
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
|
|
468 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
|
|
469 |
#endif
|
|
470 |
#if CYTHON_COMPILING_IN_PYPY
|
|
471 |
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
|
|
472 |
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
|
|
473 |
#else
|
|
474 |
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
|
|
475 |
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
|
|
476 |
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
|
|
477 |
#endif
|
|
478 |
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
|
|
479 |
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
|
|
480 |
#endif
|
|
481 |
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
|
|
482 |
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
|
|
483 |
#endif
|
|
484 |
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
|
|
485 |
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
|
|
486 |
#endif
|
|
487 |
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
|
|
488 |
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
|
|
489 |
#if PY_MAJOR_VERSION >= 3
|
|
490 |
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
|
|
491 |
#else
|
|
492 |
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
|
|
493 |
#endif
|
|
494 |
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
|
|
495 |
#define PyObject_ASCII(o) PyObject_Repr(o)
|
|
496 |
#endif
|
|
497 |
#if PY_MAJOR_VERSION >= 3
|
|
498 |
#define PyBaseString_Type PyUnicode_Type
|
|
499 |
#define PyStringObject PyUnicodeObject
|
|
500 |
#define PyString_Type PyUnicode_Type
|
|
501 |
#define PyString_Check PyUnicode_Check
|
|
502 |
#define PyString_CheckExact PyUnicode_CheckExact
|
|
503 |
#ifndef PyObject_Unicode
|
|
504 |
#define PyObject_Unicode PyObject_Str
|
|
505 |
#endif
|
|
506 |
#endif
|
|
507 |
#if PY_MAJOR_VERSION >= 3
|
|
508 |
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
|
|
509 |
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
|
|
510 |
#else
|
|
511 |
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
|
|
512 |
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
|
|
513 |
#endif
|
|
514 |
#ifndef PySet_CheckExact
|
|
515 |
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
|
|
516 |
#endif
|
|
517 |
#if PY_VERSION_HEX >= 0x030900A4
|
|
518 |
#define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
|
|
519 |
#define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
|
|
520 |
#else
|
|
521 |
#define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
|
|
522 |
#define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
|
|
523 |
#endif
|
|
524 |
#if CYTHON_ASSUME_SAFE_MACROS
|
|
525 |
#define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
|
|
526 |
#else
|
|
527 |
#define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
|
|
528 |
#endif
|
|
529 |
#if PY_MAJOR_VERSION >= 3
|
|
530 |
#define PyIntObject PyLongObject
|
|
531 |
#define PyInt_Type PyLong_Type
|
|
532 |
#define PyInt_Check(op) PyLong_Check(op)
|
|
533 |
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
|
|
534 |
#define PyInt_FromString PyLong_FromString
|
|
535 |
#define PyInt_FromUnicode PyLong_FromUnicode
|
|
536 |
#define PyInt_FromLong PyLong_FromLong
|
|
537 |
#define PyInt_FromSize_t PyLong_FromSize_t
|
|
538 |
#define PyInt_FromSsize_t PyLong_FromSsize_t
|
|
539 |
#define PyInt_AsLong PyLong_AsLong
|
|
540 |
#define PyInt_AS_LONG PyLong_AS_LONG
|
|
541 |
#define PyInt_AsSsize_t PyLong_AsSsize_t
|
|
542 |
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
|
|
543 |
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
|
|
544 |
#define PyNumber_Int PyNumber_Long
|
|
545 |
#endif
|
|
546 |
#if PY_MAJOR_VERSION >= 3
|
|
547 |
#define PyBoolObject PyLongObject
|
|
548 |
#endif
|
|
549 |
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
|
|
550 |
#ifndef PyUnicode_InternFromString
|
|
551 |
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
|
|
552 |
#endif
|
|
553 |
#endif
|
|
554 |
#if PY_VERSION_HEX < 0x030200A4
|
|
555 |
typedef long Py_hash_t;
|
|
556 |
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
|
|
557 |
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
|
|
558 |
#else
|
|
559 |
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
|
|
560 |
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
|
|
561 |
#endif
|
|
562 |
#if PY_MAJOR_VERSION >= 3
|
|
563 |
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
|
|
564 |
#else
|
|
565 |
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
|
|
566 |
#endif
|
|
567 |
#if CYTHON_USE_ASYNC_SLOTS
|
|
568 |
#if PY_VERSION_HEX >= 0x030500B1
|
|
569 |
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
|
|
570 |
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
|
|
571 |
#else
|
|
572 |
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
|
|
573 |
#endif
|
|
574 |
#else
|
|
575 |
#define __Pyx_PyType_AsAsync(obj) NULL
|
|
576 |
#endif
|
|
577 |
#ifndef __Pyx_PyAsyncMethodsStruct
|
|
578 |
typedef struct {
|
|
579 |
unaryfunc am_await;
|
|
580 |
unaryfunc am_aiter;
|
|
581 |
unaryfunc am_anext;
|
|
582 |
} __Pyx_PyAsyncMethodsStruct;
|
|
583 |
#endif
|
|
584 |
|
|
585 |
#if defined(WIN32) || defined(MS_WINDOWS)
|
|
586 |
#define _USE_MATH_DEFINES
|
|
587 |
#endif
|
|
588 |
#include <math.h>
|
|
589 |
#ifdef NAN
|
|
590 |
#define __PYX_NAN() ((float) NAN)
|
|
591 |
#else
|
|
592 |
static CYTHON_INLINE float __PYX_NAN() {
|
|
593 |
float value;
|
|
594 |
memset(&value, 0xFF, sizeof(value));
|
|
595 |
return value;
|
|
596 |
}
|
|
597 |
#endif
|
|
598 |
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
|
|
599 |
#define __Pyx_truncl trunc
|
|
600 |
#else
|
|
601 |
#define __Pyx_truncl truncl
|
|
602 |
#endif
|
|
603 |
|
|
604 |
#define __PYX_MARK_ERR_POS(f_index, lineno) \
|
|
605 |
{ __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
|
|
606 |
#define __PYX_ERR(f_index, lineno, Ln_error) \
|
|
607 |
{ __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
|
|
608 |
|
|
609 |
#ifndef __PYX_EXTERN_C
|
|
610 |
#ifdef __cplusplus
|
|
611 |
#define __PYX_EXTERN_C extern "C"
|
|
612 |
#else
|
|
613 |
#define __PYX_EXTERN_C extern
|
|
614 |
#endif
|
|
615 |
#endif
|
|
616 |
|
|
617 |
#define __PYX_HAVE__clickhouse_driver__columns__largeint
|
|
618 |
#define __PYX_HAVE_API__clickhouse_driver__columns__largeint
|
|
619 |
/* Early includes */
|
|
620 |
#include <string.h>
|
|
621 |
#include <stdio.h>
|
|
622 |
#include "pythread.h"
|
|
623 |
#ifdef _OPENMP
|
|
624 |
#include <omp.h>
|
|
625 |
#endif /* _OPENMP */
|
|
626 |
|
|
627 |
#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
|
|
628 |
#define CYTHON_WITHOUT_ASSERTIONS
|
|
629 |
#endif
|
|
630 |
|
|
631 |
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
|
|
632 |
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
|
|
633 |
|
|
634 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
|
|
635 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
|
|
636 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
|
|
637 |
#define __PYX_DEFAULT_STRING_ENCODING ""
|
|
638 |
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
|
|
639 |
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
|
|
640 |
#define __Pyx_uchar_cast(c) ((unsigned char)c)
|
|
641 |
#define __Pyx_long_cast(x) ((long)x)
|
|
642 |
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
|
|
643 |
(sizeof(type) < sizeof(Py_ssize_t)) ||\
|
|
644 |
(sizeof(type) > sizeof(Py_ssize_t) &&\
|
|
645 |
likely(v < (type)PY_SSIZE_T_MAX ||\
|
|
646 |
v == (type)PY_SSIZE_T_MAX) &&\
|
|
647 |
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
|
|
648 |
v == (type)PY_SSIZE_T_MIN))) ||\
|
|
649 |
(sizeof(type) == sizeof(Py_ssize_t) &&\
|
|
650 |
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
|
|
651 |
v == (type)PY_SSIZE_T_MAX))) )
|
|
652 |
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
|
|
653 |
return (size_t) i < (size_t) limit;
|
|
654 |
}
|
|
655 |
#if defined (__cplusplus) && __cplusplus >= 201103L
|
|
656 |
#include <cstdlib>
|
|
657 |
#define __Pyx_sst_abs(value) std::abs(value)
|
|
658 |
#elif SIZEOF_INT >= SIZEOF_SIZE_T
|
|
659 |
#define __Pyx_sst_abs(value) abs(value)
|
|
660 |
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
|
|
661 |
#define __Pyx_sst_abs(value) labs(value)
|
|
662 |
#elif defined (_MSC_VER)
|
|
663 |
#define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
|
|
664 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
665 |
#define __Pyx_sst_abs(value) llabs(value)
|
|
666 |
#elif defined (__GNUC__)
|
|
667 |
#define __Pyx_sst_abs(value) __builtin_llabs(value)
|
|
668 |
#else
|
|
669 |
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
|
|
670 |
#endif
|
|
671 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
|
|
672 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
|
|
673 |
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
|
|
674 |
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
|
|
675 |
#define __Pyx_PyBytes_FromString PyBytes_FromString
|
|
676 |
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
|
|
677 |
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
|
|
678 |
#if PY_MAJOR_VERSION < 3
|
|
679 |
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
|
|
680 |
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
|
|
681 |
#else
|
|
682 |
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
|
|
683 |
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
|
|
684 |
#endif
|
|
685 |
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
|
|
686 |
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
|
|
687 |
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
|
|
688 |
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
|
|
689 |
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
|
|
690 |
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
|
|
691 |
#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
|
|
692 |
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
|
|
693 |
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
|
|
694 |
#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
|
|
695 |
#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
|
|
696 |
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
|
|
697 |
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
|
|
698 |
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
|
|
699 |
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
|
|
700 |
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
|
|
701 |
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
|
|
702 |
const Py_UNICODE *u_end = u;
|
|
703 |
while (*u_end++) ;
|
|
704 |
return (size_t)(u_end - u - 1);
|
|
705 |
}
|
|
706 |
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
|
|
707 |
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
|
|
708 |
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
|
|
709 |
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
|
|
710 |
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
|
|
711 |
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
|
|
712 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
|
|
713 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
|
|
714 |
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
|
|
715 |
#define __Pyx_PySequence_Tuple(obj)\
|
|
716 |
(likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
|
|
717 |
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
|
|
718 |
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
|
|
719 |
#if CYTHON_ASSUME_SAFE_MACROS
|
|
720 |
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
|
|
721 |
#else
|
|
722 |
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
|
|
723 |
#endif
|
|
724 |
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
|
|
725 |
#if PY_MAJOR_VERSION >= 3
|
|
726 |
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
|
|
727 |
#else
|
|
728 |
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
|
|
729 |
#endif
|
|
730 |
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
|
|
731 |
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
|
|
732 |
static int __Pyx_sys_getdefaultencoding_not_ascii;
|
|
733 |
static int __Pyx_init_sys_getdefaultencoding_params(void) {
|
|
734 |
PyObject* sys;
|
|
735 |
PyObject* default_encoding = NULL;
|
|
736 |
PyObject* ascii_chars_u = NULL;
|
|
737 |
PyObject* ascii_chars_b = NULL;
|
|
738 |
const char* default_encoding_c;
|
|
739 |
sys = PyImport_ImportModule("sys");
|
|
740 |
if (!sys) goto bad;
|
|
741 |
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
|
|
742 |
Py_DECREF(sys);
|
|
743 |
if (!default_encoding) goto bad;
|
|
744 |
default_encoding_c = PyBytes_AsString(default_encoding);
|
|
745 |
if (!default_encoding_c) goto bad;
|
|
746 |
if (strcmp(default_encoding_c, "ascii") == 0) {
|
|
747 |
__Pyx_sys_getdefaultencoding_not_ascii = 0;
|
|
748 |
} else {
|
|
749 |
char ascii_chars[128];
|
|
750 |
int c;
|
|
751 |
for (c = 0; c < 128; c++) {
|
|
752 |
ascii_chars[c] = c;
|
|
753 |
}
|
|
754 |
__Pyx_sys_getdefaultencoding_not_ascii = 1;
|
|
755 |
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
|
|
756 |
if (!ascii_chars_u) goto bad;
|
|
757 |
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
|
|
758 |
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
|
|
759 |
PyErr_Format(
|
|
760 |
PyExc_ValueError,
|
|
761 |
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
|
|
762 |
default_encoding_c);
|
|
763 |
goto bad;
|
|
764 |
}
|
|
765 |
Py_DECREF(ascii_chars_u);
|
|
766 |
Py_DECREF(ascii_chars_b);
|
|
767 |
}
|
|
768 |
Py_DECREF(default_encoding);
|
|
769 |
return 0;
|
|
770 |
bad:
|
|
771 |
Py_XDECREF(default_encoding);
|
|
772 |
Py_XDECREF(ascii_chars_u);
|
|
773 |
Py_XDECREF(ascii_chars_b);
|
|
774 |
return -1;
|
|
775 |
}
|
|
776 |
#endif
|
|
777 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
|
|
778 |
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
|
|
779 |
#else
|
|
780 |
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
|
|
781 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
|
|
782 |
static char* __PYX_DEFAULT_STRING_ENCODING;
|
|
783 |
static int __Pyx_init_sys_getdefaultencoding_params(void) {
|
|
784 |
PyObject* sys;
|
|
785 |
PyObject* default_encoding = NULL;
|
|
786 |
char* default_encoding_c;
|
|
787 |
sys = PyImport_ImportModule("sys");
|
|
788 |
if (!sys) goto bad;
|
|
789 |
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
|
|
790 |
Py_DECREF(sys);
|
|
791 |
if (!default_encoding) goto bad;
|
|
792 |
default_encoding_c = PyBytes_AsString(default_encoding);
|
|
793 |
if (!default_encoding_c) goto bad;
|
|
794 |
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
|
|
795 |
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
|
|
796 |
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
|
|
797 |
Py_DECREF(default_encoding);
|
|
798 |
return 0;
|
|
799 |
bad:
|
|
800 |
Py_XDECREF(default_encoding);
|
|
801 |
return -1;
|
|
802 |
}
|
|
803 |
#endif
|
|
804 |
#endif
|
|
805 |
|
|
806 |
|
|
807 |
/* Test for GCC > 2.95 */
|
|
808 |
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
|
|
809 |
#define likely(x) __builtin_expect(!!(x), 1)
|
|
810 |
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
811 |
#else /* !__GNUC__ or GCC < 2.95 */
|
|
812 |
#define likely(x) (x)
|
|
813 |
#define unlikely(x) (x)
|
|
814 |
#endif /* __GNUC__ */
|
|
815 |
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
|
|
816 |
|
|
817 |
static PyObject *__pyx_m = NULL;
|
|
818 |
static PyObject *__pyx_d;
|
|
819 |
static PyObject *__pyx_b;
|
|
820 |
static PyObject *__pyx_cython_runtime = NULL;
|
|
821 |
static PyObject *__pyx_empty_tuple;
|
|
822 |
static PyObject *__pyx_empty_bytes;
|
|
823 |
static PyObject *__pyx_empty_unicode;
|
|
824 |
static int __pyx_lineno;
|
|
825 |
static int __pyx_clineno = 0;
|
|
826 |
static const char * __pyx_cfilenm= __FILE__;
|
|
827 |
static const char *__pyx_filename;
|
|
828 |
|
|
829 |
|
|
830 |
static const char *__pyx_f[] = {
|
|
831 |
"clickhouse_driver/columns/largeint.pyx",
|
|
832 |
"type.pxd",
|
|
833 |
"bool.pxd",
|
|
834 |
"complex.pxd",
|
|
835 |
};
|
|
836 |
|
|
837 |
/*--- Type declarations ---*/
|
|
838 |
|
|
839 |
/* --- Runtime support code (head) --- */
|
|
840 |
/* Refnanny.proto */
|
|
841 |
#ifndef CYTHON_REFNANNY
|
|
842 |
#define CYTHON_REFNANNY 0
|
|
843 |
#endif
|
|
844 |
#if CYTHON_REFNANNY
|
|
845 |
typedef struct {
|
|
846 |
void (*INCREF)(void*, PyObject*, int);
|
|
847 |
void (*DECREF)(void*, PyObject*, int);
|
|
848 |
void (*GOTREF)(void*, PyObject*, int);
|
|
849 |
void (*GIVEREF)(void*, PyObject*, int);
|
|
850 |
void* (*SetupContext)(const char*, int, const char*);
|
|
851 |
void (*FinishContext)(void**);
|
|
852 |
} __Pyx_RefNannyAPIStruct;
|
|
853 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
|
|
854 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
|
|
855 |
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
|
|
856 |
#ifdef WITH_THREAD
|
|
857 |
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
|
|
858 |
if (acquire_gil) {\
|
|
859 |
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
|
|
860 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
|
|
861 |
PyGILState_Release(__pyx_gilstate_save);\
|
|
862 |
} else {\
|
|
863 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
|
|
864 |
}
|
|
865 |
#else
|
|
866 |
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
|
|
867 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
|
|
868 |
#endif
|
|
869 |
#define __Pyx_RefNannyFinishContext()\
|
|
870 |
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
|
|
871 |
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
|
|
872 |
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
|
|
873 |
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
|
|
874 |
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
|
|
875 |
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
|
|
876 |
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
|
|
877 |
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
|
|
878 |
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
|
|
879 |
#else
|
|
880 |
#define __Pyx_RefNannyDeclarations
|
|
881 |
#define __Pyx_RefNannySetupContext(name, acquire_gil)
|
|
882 |
#define __Pyx_RefNannyFinishContext()
|
|
883 |
#define __Pyx_INCREF(r) Py_INCREF(r)
|
|
884 |
#define __Pyx_DECREF(r) Py_DECREF(r)
|
|
885 |
#define __Pyx_GOTREF(r)
|
|
886 |
#define __Pyx_GIVEREF(r)
|
|
887 |
#define __Pyx_XINCREF(r) Py_XINCREF(r)
|
|
888 |
#define __Pyx_XDECREF(r) Py_XDECREF(r)
|
|
889 |
#define __Pyx_XGOTREF(r)
|
|
890 |
#define __Pyx_XGIVEREF(r)
|
|
891 |
#endif
|
|
892 |
#define __Pyx_XDECREF_SET(r, v) do {\
|
|
893 |
PyObject *tmp = (PyObject *) r;\
|
|
894 |
r = v; __Pyx_XDECREF(tmp);\
|
|
895 |
} while (0)
|
|
896 |
#define __Pyx_DECREF_SET(r, v) do {\
|
|
897 |
PyObject *tmp = (PyObject *) r;\
|
|
898 |
r = v; __Pyx_DECREF(tmp);\
|
|
899 |
} while (0)
|
|
900 |
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
|
|
901 |
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
|
|
902 |
|
|
903 |
/* PyObjectGetAttrStr.proto */
|
|
904 |
#if CYTHON_USE_TYPE_SLOTS
|
|
905 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
|
|
906 |
#else
|
|
907 |
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
|
|
908 |
#endif
|
|
909 |
|
|
910 |
/* GetBuiltinName.proto */
|
|
911 |
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
|
|
912 |
|
|
913 |
/* RaiseArgTupleInvalid.proto */
|
|
914 |
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
|
|
915 |
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
|
|
916 |
|
|
917 |
/* RaiseDoubleKeywords.proto */
|
|
918 |
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
|
|
919 |
|
|
920 |
/* ParseKeywords.proto */
|
|
921 |
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
|
|
922 |
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
|
|
923 |
const char* function_name);
|
|
924 |
|
|
925 |
/* GetItemInt.proto */
|
|
926 |
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
|
|
927 |
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
|
|
928 |
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
|
|
929 |
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
|
|
930 |
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
|
|
931 |
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
|
|
932 |
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
|
|
933 |
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
|
|
934 |
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
|
|
935 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
|
|
936 |
int wraparound, int boundscheck);
|
|
937 |
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
|
|
938 |
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
|
|
939 |
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
|
|
940 |
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
|
|
941 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
|
|
942 |
int wraparound, int boundscheck);
|
|
943 |
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
|
|
944 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
|
|
945 |
int is_list, int wraparound, int boundscheck);
|
|
946 |
|
|
947 |
/* PyIntBinop.proto */
|
|
948 |
#if !CYTHON_COMPILING_IN_PYPY
|
|
949 |
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
|
|
950 |
#else
|
|
951 |
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
|
|
952 |
(inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
|
|
953 |
#endif
|
|
954 |
|
|
955 |
/* TypeImport.proto */
|
|
956 |
#ifndef __PYX_HAVE_RT_ImportType_proto
|
|
957 |
#define __PYX_HAVE_RT_ImportType_proto
|
|
958 |
enum __Pyx_ImportType_CheckSize {
|
|
959 |
__Pyx_ImportType_CheckSize_Error = 0,
|
|
960 |
__Pyx_ImportType_CheckSize_Warn = 1,
|
|
961 |
__Pyx_ImportType_CheckSize_Ignore = 2
|
|
962 |
};
|
|
963 |
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
|
|
964 |
#endif
|
|
965 |
|
|
966 |
/* Import.proto */
|
|
967 |
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
|
|
968 |
|
|
969 |
/* ImportFrom.proto */
|
|
970 |
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
|
|
971 |
|
|
972 |
/* PyDictVersioning.proto */
|
|
973 |
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
|
|
974 |
#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
|
|
975 |
#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
|
|
976 |
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
|
|
977 |
(version_var) = __PYX_GET_DICT_VERSION(dict);\
|
|
978 |
(cache_var) = (value);
|
|
979 |
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
|
|
980 |
static PY_UINT64_T __pyx_dict_version = 0;\
|
|
981 |
static PyObject *__pyx_dict_cached_value = NULL;\
|
|
982 |
if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
|
|
983 |
(VAR) = __pyx_dict_cached_value;\
|
|
984 |
} else {\
|
|
985 |
(VAR) = __pyx_dict_cached_value = (LOOKUP);\
|
|
986 |
__pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
|
|
987 |
}\
|
|
988 |
}
|
|
989 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
|
|
990 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
|
|
991 |
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
|
|
992 |
#else
|
|
993 |
#define __PYX_GET_DICT_VERSION(dict) (0)
|
|
994 |
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
|
|
995 |
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
|
|
996 |
#endif
|
|
997 |
|
|
998 |
/* GetModuleGlobalName.proto */
|
|
999 |
#if CYTHON_USE_DICT_VERSIONS
|
|
1000 |
#define __Pyx_GetModuleGlobalName(var, name) {\
|
|
1001 |
static PY_UINT64_T __pyx_dict_version = 0;\
|
|
1002 |
static PyObject *__pyx_dict_cached_value = NULL;\
|
|
1003 |
(var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
|
|
1004 |
(likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
|
|
1005 |
__Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
|
|
1006 |
}
|
|
1007 |
#define __Pyx_GetModuleGlobalNameUncached(var, name) {\
|
|
1008 |
PY_UINT64_T __pyx_dict_version;\
|
|
1009 |
PyObject *__pyx_dict_cached_value;\
|
|
1010 |
(var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
|
|
1011 |
}
|
|
1012 |
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
|
|
1013 |
#else
|
|
1014 |
#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
|
|
1015 |
#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
|
|
1016 |
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
|
|
1017 |
#endif
|
|
1018 |
|
|
1019 |
/* PyThreadStateGet.proto */
|
|
1020 |
#if CYTHON_FAST_THREAD_STATE
|
|
1021 |
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
|
|
1022 |
#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
|
|
1023 |
#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
|
|
1024 |
#else
|
|
1025 |
#define __Pyx_PyThreadState_declare
|
|
1026 |
#define __Pyx_PyThreadState_assign
|
|
1027 |
#define __Pyx_PyErr_Occurred() PyErr_Occurred()
|
|
1028 |
#endif
|
|
1029 |
|
|
1030 |
/* PyErrFetchRestore.proto */
|
|
1031 |
#if CYTHON_FAST_THREAD_STATE
|
|
1032 |
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
|
|
1033 |
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
|
|
1034 |
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
|
|
1035 |
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
|
|
1036 |
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
|
|
1037 |
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
|
|
1038 |
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
|
|
1039 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
1040 |
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
|
|
1041 |
#else
|
|
1042 |
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
|
|
1043 |
#endif
|
|
1044 |
#else
|
|
1045 |
#define __Pyx_PyErr_Clear() PyErr_Clear()
|
|
1046 |
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
|
|
1047 |
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
|
|
1048 |
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
|
|
1049 |
#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
|
|
1050 |
#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
|
|
1051 |
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
|
|
1052 |
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
|
|
1053 |
#endif
|
|
1054 |
|
|
1055 |
/* CLineInTraceback.proto */
|
|
1056 |
#ifdef CYTHON_CLINE_IN_TRACEBACK
|
|
1057 |
#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
|
|
1058 |
#else
|
|
1059 |
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
|
|
1060 |
#endif
|
|
1061 |
|
|
1062 |
/* CodeObjectCache.proto */
|
|
1063 |
typedef struct {
|
|
1064 |
PyCodeObject* code_object;
|
|
1065 |
int code_line;
|
|
1066 |
} __Pyx_CodeObjectCacheEntry;
|
|
1067 |
struct __Pyx_CodeObjectCache {
|
|
1068 |
int count;
|
|
1069 |
int max_count;
|
|
1070 |
__Pyx_CodeObjectCacheEntry* entries;
|
|
1071 |
};
|
|
1072 |
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
|
|
1073 |
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
|
|
1074 |
static PyCodeObject *__pyx_find_code_object(int code_line);
|
|
1075 |
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
|
|
1076 |
|
|
1077 |
/* AddTraceback.proto */
|
|
1078 |
static void __Pyx_AddTraceback(const char *funcname, int c_line,
|
|
1079 |
int py_line, const char *filename);
|
|
1080 |
|
|
1081 |
/* CIntToPy.proto */
|
|
1082 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value);
|
|
1083 |
|
|
1084 |
/* CIntFromPy.proto */
|
|
1085 |
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *);
|
|
1086 |
|
|
1087 |
/* CIntToPy.proto */
|
|
1088 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
|
|
1089 |
|
|
1090 |
/* CIntFromPy.proto */
|
|
1091 |
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
|
|
1092 |
|
|
1093 |
/* CIntFromPy.proto */
|
|
1094 |
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
|
|
1095 |
|
|
1096 |
/* FastTypeChecks.proto */
|
|
1097 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
1098 |
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
|
|
1099 |
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
|
|
1100 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
|
|
1101 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
|
|
1102 |
#else
|
|
1103 |
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
|
|
1104 |
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
|
|
1105 |
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
|
|
1106 |
#endif
|
|
1107 |
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
|
|
1108 |
|
|
1109 |
/* CheckBinaryVersion.proto */
|
|
1110 |
static int __Pyx_check_binary_version(void);
|
|
1111 |
|
|
1112 |
/* InitStrings.proto */
|
|
1113 |
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
|
|
1114 |
|
|
1115 |
|
|
1116 |
/* Module declarations from 'cpython.version' */
|
|
1117 |
|
|
1118 |
/* Module declarations from '__builtin__' */
|
|
1119 |
|
|
1120 |
/* Module declarations from 'cpython.type' */
|
|
1121 |
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
|
|
1122 |
|
|
1123 |
/* Module declarations from 'libc.string' */
|
|
1124 |
|
|
1125 |
/* Module declarations from 'libc.stdio' */
|
|
1126 |
|
|
1127 |
/* Module declarations from 'cpython.object' */
|
|
1128 |
|
|
1129 |
/* Module declarations from 'cpython.ref' */
|
|
1130 |
|
|
1131 |
/* Module declarations from 'cpython.exc' */
|
|
1132 |
|
|
1133 |
/* Module declarations from 'cpython.module' */
|
|
1134 |
|
|
1135 |
/* Module declarations from 'cpython.mem' */
|
|
1136 |
|
|
1137 |
/* Module declarations from 'cpython.tuple' */
|
|
1138 |
|
|
1139 |
/* Module declarations from 'cpython.list' */
|
|
1140 |
|
|
1141 |
/* Module declarations from 'cpython.sequence' */
|
|
1142 |
|
|
1143 |
/* Module declarations from 'cpython.mapping' */
|
|
1144 |
|
|
1145 |
/* Module declarations from 'cpython.iterator' */
|
|
1146 |
|
|
1147 |
/* Module declarations from 'cpython.number' */
|
|
1148 |
|
|
1149 |
/* Module declarations from 'cpython.int' */
|
|
1150 |
|
|
1151 |
/* Module declarations from '__builtin__' */
|
|
1152 |
|
|
1153 |
/* Module declarations from 'cpython.bool' */
|
|
1154 |
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
|
|
1155 |
|
|
1156 |
/* Module declarations from 'cpython.long' */
|
|
1157 |
|
|
1158 |
/* Module declarations from 'cpython.float' */
|
|
1159 |
|
|
1160 |
/* Module declarations from '__builtin__' */
|
|
1161 |
|
|
1162 |
/* Module declarations from 'cpython.complex' */
|
|
1163 |
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
|
|
1164 |
|
|
1165 |
/* Module declarations from 'cpython.string' */
|
|
1166 |
|
|
1167 |
/* Module declarations from 'cpython.unicode' */
|
|
1168 |
|
|
1169 |
/* Module declarations from 'cpython.dict' */
|
|
1170 |
|
|
1171 |
/* Module declarations from 'cpython.instance' */
|
|
1172 |
|
|
1173 |
/* Module declarations from 'cpython.function' */
|
|
1174 |
|
|
1175 |
/* Module declarations from 'cpython.method' */
|
|
1176 |
|
|
1177 |
/* Module declarations from 'cpython.weakref' */
|
|
1178 |
|
|
1179 |
/* Module declarations from 'cpython.getargs' */
|
|
1180 |
|
|
1181 |
/* Module declarations from 'cpython.pythread' */
|
|
1182 |
|
|
1183 |
/* Module declarations from 'cpython.pystate' */
|
|
1184 |
|
|
1185 |
/* Module declarations from 'cpython.cobject' */
|
|
1186 |
|
|
1187 |
/* Module declarations from 'cpython.oldbuffer' */
|
|
1188 |
|
|
1189 |
/* Module declarations from 'cpython.set' */
|
|
1190 |
|
|
1191 |
/* Module declarations from 'cpython.buffer' */
|
|
1192 |
|
|
1193 |
/* Module declarations from 'cpython.bytes' */
|
|
1194 |
|
|
1195 |
/* Module declarations from 'cpython.pycapsule' */
|
|
1196 |
|
|
1197 |
/* Module declarations from 'cpython' */
|
|
1198 |
|
|
1199 |
/* Module declarations from 'clickhouse_driver.columns.largeint' */
|
|
1200 |
static PyObject *__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64 = 0;
|
|
1201 |
static PyObject *__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_INT64 = 0;
|
|
1202 |
#define __Pyx_MODULE_NAME "clickhouse_driver.columns.largeint"
|
|
1203 |
extern int __pyx_module_is_main_clickhouse_driver__columns__largeint;
|
|
1204 |
int __pyx_module_is_main_clickhouse_driver__columns__largeint = 0;
|
|
1205 |
|
|
1206 |
/* Implementation of 'clickhouse_driver.columns.largeint' */
|
|
1207 |
static PyObject *__pyx_builtin_range;
|
|
1208 |
static const char __pyx_k_[] = "";
|
|
1209 |
static const char __pyx_k_i[] = "i";
|
|
1210 |
static const char __pyx_k_x[] = "x";
|
|
1211 |
static const char __pyx_k_ix[] = "ix";
|
|
1212 |
static const char __pyx_k_item[] = "item";
|
|
1213 |
static const char __pyx_k_main[] = "__main__";
|
|
1214 |
static const char __pyx_k_name[] = "__name__";
|
|
1215 |
static const char __pyx_k_test[] = "__test__";
|
|
1216 |
static const char __pyx_k_items[] = "items";
|
|
1217 |
static const char __pyx_k_range[] = "range";
|
|
1218 |
static const char __pyx_k_factor[] = "factor";
|
|
1219 |
static const char __pyx_k_import[] = "__import__";
|
|
1220 |
static const char __pyx_k_writer[] = "writer";
|
|
1221 |
static const char __pyx_k_n_items[] = "n_items";
|
|
1222 |
static const char __pyx_k_MAX_INT64[] = "MAX_INT64";
|
|
1223 |
static const char __pyx_k_MAX_UINT64[] = "MAX_UINT64";
|
|
1224 |
static const char __pyx_k_quad_items[] = "quad_items";
|
|
1225 |
static const char __pyx_k_int128_to_quads[] = "int128_to_quads";
|
|
1226 |
static const char __pyx_k_int256_to_quads[] = "int256_to_quads";
|
|
1227 |
static const char __pyx_k_uint128_to_quads[] = "uint128_to_quads";
|
|
1228 |
static const char __pyx_k_uint256_to_quads[] = "uint256_to_quads";
|
|
1229 |
static const char __pyx_k_int128_from_quads[] = "int128_from_quads";
|
|
1230 |
static const char __pyx_k_int256_from_quads[] = "int256_from_quads";
|
|
1231 |
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
|
|
1232 |
static const char __pyx_k_uint128_from_quads[] = "uint128_from_quads";
|
|
1233 |
static const char __pyx_k_uint256_from_quads[] = "uint256_from_quads";
|
|
1234 |
static const char __pyx_k_clickhouse_driver_columns_largei[] = "clickhouse_driver/columns/largeint.pyx";
|
|
1235 |
static const char __pyx_k_clickhouse_driver_columns_largei_2[] = "clickhouse_driver.columns.largeint";
|
|
1236 |
static PyObject *__pyx_n_s_;
|
|
1237 |
static PyObject *__pyx_n_s_MAX_INT64;
|
|
1238 |
static PyObject *__pyx_n_s_MAX_UINT64;
|
|
1239 |
static PyObject *__pyx_kp_s_clickhouse_driver_columns_largei;
|
|
1240 |
static PyObject *__pyx_n_s_clickhouse_driver_columns_largei_2;
|
|
1241 |
static PyObject *__pyx_n_s_cline_in_traceback;
|
|
1242 |
static PyObject *__pyx_n_s_factor;
|
|
1243 |
static PyObject *__pyx_n_s_i;
|
|
1244 |
static PyObject *__pyx_n_s_import;
|
|
1245 |
static PyObject *__pyx_n_s_int128_from_quads;
|
|
1246 |
static PyObject *__pyx_n_s_int128_to_quads;
|
|
1247 |
static PyObject *__pyx_n_s_int256_from_quads;
|
|
1248 |
static PyObject *__pyx_n_s_int256_to_quads;
|
|
1249 |
static PyObject *__pyx_n_s_item;
|
|
1250 |
static PyObject *__pyx_n_s_items;
|
|
1251 |
static PyObject *__pyx_n_s_ix;
|
|
1252 |
static PyObject *__pyx_n_s_main;
|
|
1253 |
static PyObject *__pyx_n_s_n_items;
|
|
1254 |
static PyObject *__pyx_n_s_name;
|
|
1255 |
static PyObject *__pyx_n_s_quad_items;
|
|
1256 |
static PyObject *__pyx_n_s_range;
|
|
1257 |
static PyObject *__pyx_n_s_test;
|
|
1258 |
static PyObject *__pyx_n_s_uint128_from_quads;
|
|
1259 |
static PyObject *__pyx_n_s_uint128_to_quads;
|
|
1260 |
static PyObject *__pyx_n_s_uint256_from_quads;
|
|
1261 |
static PyObject *__pyx_n_s_uint256_to_quads;
|
|
1262 |
static PyObject *__pyx_n_s_writer;
|
|
1263 |
static PyObject *__pyx_n_s_x;
|
|
1264 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_int128_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1265 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_2int128_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1266 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_4uint128_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1267 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_6uint128_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1268 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_8int256_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1269 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_10int256_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1270 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_12uint256_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1271 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_14uint256_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items); /* proto */
|
|
1272 |
static PyObject *__pyx_int_0;
|
|
1273 |
static PyObject *__pyx_int_1;
|
|
1274 |
static PyObject *__pyx_int_64;
|
|
1275 |
static PyObject *__pyx_int_128;
|
|
1276 |
static PyObject *__pyx_int_192;
|
|
1277 |
static PyObject *__pyx_tuple__2;
|
|
1278 |
static PyObject *__pyx_tuple__4;
|
|
1279 |
static PyObject *__pyx_tuple__6;
|
|
1280 |
static PyObject *__pyx_tuple__8;
|
|
1281 |
static PyObject *__pyx_tuple__10;
|
|
1282 |
static PyObject *__pyx_tuple__12;
|
|
1283 |
static PyObject *__pyx_tuple__14;
|
|
1284 |
static PyObject *__pyx_tuple__16;
|
|
1285 |
static PyObject *__pyx_codeobj__3;
|
|
1286 |
static PyObject *__pyx_codeobj__5;
|
|
1287 |
static PyObject *__pyx_codeobj__7;
|
|
1288 |
static PyObject *__pyx_codeobj__9;
|
|
1289 |
static PyObject *__pyx_codeobj__11;
|
|
1290 |
static PyObject *__pyx_codeobj__13;
|
|
1291 |
static PyObject *__pyx_codeobj__15;
|
|
1292 |
static PyObject *__pyx_codeobj__17;
|
|
1293 |
/* Late includes */
|
|
1294 |
|
|
1295 |
/* "clickhouse_driver/columns/largeint.pyx":10
|
|
1296 |
*
|
|
1297 |
*
|
|
1298 |
* def int128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
1299 |
* cdef unsigned int factor = 2
|
|
1300 |
* items = PyTuple_New(n_items)
|
|
1301 |
*/
|
|
1302 |
|
|
1303 |
/* Python wrapper */
|
|
1304 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_1int128_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
1305 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_1int128_from_quads = {"int128_from_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_1int128_from_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
1306 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_1int128_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
1307 |
PyObject *__pyx_v_quad_items = 0;
|
|
1308 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
1309 |
int __pyx_lineno = 0;
|
|
1310 |
const char *__pyx_filename = NULL;
|
|
1311 |
int __pyx_clineno = 0;
|
|
1312 |
PyObject *__pyx_r = 0;
|
|
1313 |
__Pyx_RefNannyDeclarations
|
|
1314 |
__Pyx_RefNannySetupContext("int128_from_quads (wrapper)", 0);
|
|
1315 |
{
|
|
1316 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_quad_items,&__pyx_n_s_n_items,0};
|
|
1317 |
PyObject* values[2] = {0,0};
|
|
1318 |
if (unlikely(__pyx_kwds)) {
|
|
1319 |
Py_ssize_t kw_args;
|
|
1320 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
1321 |
switch (pos_args) {
|
|
1322 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
1323 |
CYTHON_FALLTHROUGH;
|
|
1324 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
1325 |
CYTHON_FALLTHROUGH;
|
|
1326 |
case 0: break;
|
|
1327 |
default: goto __pyx_L5_argtuple_error;
|
|
1328 |
}
|
|
1329 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
1330 |
switch (pos_args) {
|
|
1331 |
case 0:
|
|
1332 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quad_items)) != 0)) kw_args--;
|
|
1333 |
else goto __pyx_L5_argtuple_error;
|
|
1334 |
CYTHON_FALLTHROUGH;
|
|
1335 |
case 1:
|
|
1336 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
1337 |
else {
|
|
1338 |
__Pyx_RaiseArgtupleInvalid("int128_from_quads", 1, 2, 2, 1); __PYX_ERR(0, 10, __pyx_L3_error)
|
|
1339 |
}
|
|
1340 |
}
|
|
1341 |
if (unlikely(kw_args > 0)) {
|
|
1342 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "int128_from_quads") < 0)) __PYX_ERR(0, 10, __pyx_L3_error)
|
|
1343 |
}
|
|
1344 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
1345 |
goto __pyx_L5_argtuple_error;
|
|
1346 |
} else {
|
|
1347 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
1348 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
1349 |
}
|
|
1350 |
__pyx_v_quad_items = values[0];
|
|
1351 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error)
|
|
1352 |
}
|
|
1353 |
goto __pyx_L4_argument_unpacking_done;
|
|
1354 |
__pyx_L5_argtuple_error:;
|
|
1355 |
__Pyx_RaiseArgtupleInvalid("int128_from_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 10, __pyx_L3_error)
|
|
1356 |
__pyx_L3_error:;
|
|
1357 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int128_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1358 |
__Pyx_RefNannyFinishContext();
|
|
1359 |
return NULL;
|
|
1360 |
__pyx_L4_argument_unpacking_done:;
|
|
1361 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_int128_from_quads(__pyx_self, __pyx_v_quad_items, __pyx_v_n_items);
|
|
1362 |
|
|
1363 |
/* function exit code */
|
|
1364 |
__Pyx_RefNannyFinishContext();
|
|
1365 |
return __pyx_r;
|
|
1366 |
}
|
|
1367 |
|
|
1368 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_int128_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
1369 |
unsigned int __pyx_v_factor;
|
|
1370 |
PyObject *__pyx_v_items = NULL;
|
|
1371 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
1372 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
1373 |
PyObject *__pyx_v_item = 0;
|
|
1374 |
PyObject *__pyx_r = NULL;
|
|
1375 |
__Pyx_RefNannyDeclarations
|
|
1376 |
PyObject *__pyx_t_1 = NULL;
|
|
1377 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
1378 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
1379 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
1380 |
unsigned PY_LONG_LONG __pyx_t_5;
|
|
1381 |
PyObject *__pyx_t_6 = NULL;
|
|
1382 |
int __pyx_t_7;
|
|
1383 |
PyObject *__pyx_t_8 = NULL;
|
|
1384 |
int __pyx_lineno = 0;
|
|
1385 |
const char *__pyx_filename = NULL;
|
|
1386 |
int __pyx_clineno = 0;
|
|
1387 |
__Pyx_RefNannySetupContext("int128_from_quads", 0);
|
|
1388 |
|
|
1389 |
/* "clickhouse_driver/columns/largeint.pyx":11
|
|
1390 |
*
|
|
1391 |
* def int128_from_quads(quad_items, unsigned long long n_items):
|
|
1392 |
* cdef unsigned int factor = 2 # <<<<<<<<<<<<<<
|
|
1393 |
* items = PyTuple_New(n_items)
|
|
1394 |
*
|
|
1395 |
*/
|
|
1396 |
__pyx_v_factor = 2;
|
|
1397 |
|
|
1398 |
/* "clickhouse_driver/columns/largeint.pyx":12
|
|
1399 |
* def int128_from_quads(quad_items, unsigned long long n_items):
|
|
1400 |
* cdef unsigned int factor = 2
|
|
1401 |
* items = PyTuple_New(n_items) # <<<<<<<<<<<<<<
|
|
1402 |
*
|
|
1403 |
* cdef unsigned long long i, ix
|
|
1404 |
*/
|
|
1405 |
__pyx_t_1 = PyTuple_New(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
|
|
1406 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1407 |
__pyx_v_items = ((PyObject*)__pyx_t_1);
|
|
1408 |
__pyx_t_1 = 0;
|
|
1409 |
|
|
1410 |
/* "clickhouse_driver/columns/largeint.pyx":17
|
|
1411 |
* cdef object item
|
|
1412 |
*
|
|
1413 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
1414 |
* ix = factor * i
|
|
1415 |
*
|
|
1416 |
*/
|
|
1417 |
__pyx_t_2 = __pyx_v_n_items;
|
|
1418 |
__pyx_t_3 = __pyx_t_2;
|
|
1419 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
1420 |
__pyx_v_i = __pyx_t_4;
|
|
1421 |
|
|
1422 |
/* "clickhouse_driver/columns/largeint.pyx":18
|
|
1423 |
*
|
|
1424 |
* for i in range(n_items):
|
|
1425 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
1426 |
*
|
|
1427 |
* if quad_items[ix + 1] > MAX_INT64:
|
|
1428 |
*/
|
|
1429 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
1430 |
|
|
1431 |
/* "clickhouse_driver/columns/largeint.pyx":20
|
|
1432 |
* ix = factor * i
|
|
1433 |
*
|
|
1434 |
* if quad_items[ix + 1] > MAX_INT64: # <<<<<<<<<<<<<<
|
|
1435 |
* item = (
|
|
1436 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
1437 |
*/
|
|
1438 |
__pyx_t_5 = (__pyx_v_ix + 1);
|
|
1439 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
|
|
1440 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1441 |
__pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_INT64, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error)
|
|
1442 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
1443 |
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 20, __pyx_L1_error)
|
|
1444 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1445 |
if (__pyx_t_7) {
|
|
1446 |
|
|
1447 |
/* "clickhouse_driver/columns/largeint.pyx":22
|
|
1448 |
* if quad_items[ix + 1] > MAX_INT64:
|
|
1449 |
* item = (
|
|
1450 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64) # <<<<<<<<<<<<<<
|
|
1451 |
* - (MAX_UINT64 - quad_items[ix])
|
|
1452 |
* - 1
|
|
1453 |
*/
|
|
1454 |
__pyx_t_5 = (__pyx_v_ix + 1);
|
|
1455 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
|
|
1456 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1457 |
__pyx_t_1 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
|
|
1458 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1459 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1460 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error)
|
|
1461 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1462 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
1463 |
__pyx_t_1 = PyNumber_Negative(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
|
|
1464 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1465 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1466 |
|
|
1467 |
/* "clickhouse_driver/columns/largeint.pyx":23
|
|
1468 |
* item = (
|
|
1469 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
1470 |
* - (MAX_UINT64 - quad_items[ix]) # <<<<<<<<<<<<<<
|
|
1471 |
* - 1
|
|
1472 |
* )
|
|
1473 |
*/
|
|
1474 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_v_ix, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
|
|
1475 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1476 |
__pyx_t_8 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 23, __pyx_L1_error)
|
|
1477 |
__Pyx_GOTREF(__pyx_t_8);
|
|
1478 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1479 |
__pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error)
|
|
1480 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1481 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
1482 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
1483 |
|
|
1484 |
/* "clickhouse_driver/columns/largeint.pyx":24
|
|
1485 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
1486 |
* - (MAX_UINT64 - quad_items[ix])
|
|
1487 |
* - 1 # <<<<<<<<<<<<<<
|
|
1488 |
* )
|
|
1489 |
*
|
|
1490 |
*/
|
|
1491 |
__pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 24, __pyx_L1_error)
|
|
1492 |
__Pyx_GOTREF(__pyx_t_8);
|
|
1493 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1494 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
|
|
1495 |
__pyx_t_8 = 0;
|
|
1496 |
|
|
1497 |
/* "clickhouse_driver/columns/largeint.pyx":20
|
|
1498 |
* ix = factor * i
|
|
1499 |
*
|
|
1500 |
* if quad_items[ix + 1] > MAX_INT64: # <<<<<<<<<<<<<<
|
|
1501 |
* item = (
|
|
1502 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
1503 |
*/
|
|
1504 |
goto __pyx_L5;
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
/* "clickhouse_driver/columns/largeint.pyx":28
|
|
1508 |
*
|
|
1509 |
* else:
|
|
1510 |
* item = (quad_items[ix + 1] << 64) + quad_items[ix] # <<<<<<<<<<<<<<
|
|
1511 |
*
|
|
1512 |
* Py_INCREF(item)
|
|
1513 |
*/
|
|
1514 |
/*else*/ {
|
|
1515 |
__pyx_t_5 = (__pyx_v_ix + 1);
|
|
1516 |
__pyx_t_8 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 28, __pyx_L1_error)
|
|
1517 |
__Pyx_GOTREF(__pyx_t_8);
|
|
1518 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_8, __pyx_int_64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 28, __pyx_L1_error)
|
|
1519 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1520 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
1521 |
__pyx_t_8 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_v_ix, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 28, __pyx_L1_error)
|
|
1522 |
__Pyx_GOTREF(__pyx_t_8);
|
|
1523 |
__pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
|
|
1524 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1525 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1526 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
1527 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
1528 |
__pyx_t_1 = 0;
|
|
1529 |
}
|
|
1530 |
__pyx_L5:;
|
|
1531 |
|
|
1532 |
/* "clickhouse_driver/columns/largeint.pyx":30
|
|
1533 |
* item = (quad_items[ix + 1] << 64) + quad_items[ix]
|
|
1534 |
*
|
|
1535 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
1536 |
* PyTuple_SET_ITEM(items, i, item)
|
|
1537 |
*
|
|
1538 |
*/
|
|
1539 |
Py_INCREF(__pyx_v_item);
|
|
1540 |
|
|
1541 |
/* "clickhouse_driver/columns/largeint.pyx":31
|
|
1542 |
*
|
|
1543 |
* Py_INCREF(item)
|
|
1544 |
* PyTuple_SET_ITEM(items, i, item) # <<<<<<<<<<<<<<
|
|
1545 |
*
|
|
1546 |
* return items
|
|
1547 |
*/
|
|
1548 |
PyTuple_SET_ITEM(__pyx_v_items, __pyx_v_i, __pyx_v_item);
|
|
1549 |
}
|
|
1550 |
|
|
1551 |
/* "clickhouse_driver/columns/largeint.pyx":33
|
|
1552 |
* PyTuple_SET_ITEM(items, i, item)
|
|
1553 |
*
|
|
1554 |
* return items # <<<<<<<<<<<<<<
|
|
1555 |
*
|
|
1556 |
*
|
|
1557 |
*/
|
|
1558 |
__Pyx_XDECREF(__pyx_r);
|
|
1559 |
__Pyx_INCREF(__pyx_v_items);
|
|
1560 |
__pyx_r = __pyx_v_items;
|
|
1561 |
goto __pyx_L0;
|
|
1562 |
|
|
1563 |
/* "clickhouse_driver/columns/largeint.pyx":10
|
|
1564 |
*
|
|
1565 |
*
|
|
1566 |
* def int128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
1567 |
* cdef unsigned int factor = 2
|
|
1568 |
* items = PyTuple_New(n_items)
|
|
1569 |
*/
|
|
1570 |
|
|
1571 |
/* function exit code */
|
|
1572 |
__pyx_L1_error:;
|
|
1573 |
__Pyx_XDECREF(__pyx_t_1);
|
|
1574 |
__Pyx_XDECREF(__pyx_t_6);
|
|
1575 |
__Pyx_XDECREF(__pyx_t_8);
|
|
1576 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int128_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1577 |
__pyx_r = NULL;
|
|
1578 |
__pyx_L0:;
|
|
1579 |
__Pyx_XDECREF(__pyx_v_items);
|
|
1580 |
__Pyx_XDECREF(__pyx_v_item);
|
|
1581 |
__Pyx_XGIVEREF(__pyx_r);
|
|
1582 |
__Pyx_RefNannyFinishContext();
|
|
1583 |
return __pyx_r;
|
|
1584 |
}
|
|
1585 |
|
|
1586 |
/* "clickhouse_driver/columns/largeint.pyx":36
|
|
1587 |
*
|
|
1588 |
*
|
|
1589 |
* def int128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
1590 |
* cdef unsigned int factor = 2
|
|
1591 |
* quad_items = PyTuple_New(n_items * factor)
|
|
1592 |
*/
|
|
1593 |
|
|
1594 |
/* Python wrapper */
|
|
1595 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_3int128_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
1596 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_3int128_to_quads = {"int128_to_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_3int128_to_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
1597 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_3int128_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
1598 |
PyObject *__pyx_v_items = 0;
|
|
1599 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
1600 |
int __pyx_lineno = 0;
|
|
1601 |
const char *__pyx_filename = NULL;
|
|
1602 |
int __pyx_clineno = 0;
|
|
1603 |
PyObject *__pyx_r = 0;
|
|
1604 |
__Pyx_RefNannyDeclarations
|
|
1605 |
__Pyx_RefNannySetupContext("int128_to_quads (wrapper)", 0);
|
|
1606 |
{
|
|
1607 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,&__pyx_n_s_n_items,0};
|
|
1608 |
PyObject* values[2] = {0,0};
|
|
1609 |
if (unlikely(__pyx_kwds)) {
|
|
1610 |
Py_ssize_t kw_args;
|
|
1611 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
1612 |
switch (pos_args) {
|
|
1613 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
1614 |
CYTHON_FALLTHROUGH;
|
|
1615 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
1616 |
CYTHON_FALLTHROUGH;
|
|
1617 |
case 0: break;
|
|
1618 |
default: goto __pyx_L5_argtuple_error;
|
|
1619 |
}
|
|
1620 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
1621 |
switch (pos_args) {
|
|
1622 |
case 0:
|
|
1623 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items)) != 0)) kw_args--;
|
|
1624 |
else goto __pyx_L5_argtuple_error;
|
|
1625 |
CYTHON_FALLTHROUGH;
|
|
1626 |
case 1:
|
|
1627 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
1628 |
else {
|
|
1629 |
__Pyx_RaiseArgtupleInvalid("int128_to_quads", 1, 2, 2, 1); __PYX_ERR(0, 36, __pyx_L3_error)
|
|
1630 |
}
|
|
1631 |
}
|
|
1632 |
if (unlikely(kw_args > 0)) {
|
|
1633 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "int128_to_quads") < 0)) __PYX_ERR(0, 36, __pyx_L3_error)
|
|
1634 |
}
|
|
1635 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
1636 |
goto __pyx_L5_argtuple_error;
|
|
1637 |
} else {
|
|
1638 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
1639 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
1640 |
}
|
|
1641 |
__pyx_v_items = values[0];
|
|
1642 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
|
|
1643 |
}
|
|
1644 |
goto __pyx_L4_argument_unpacking_done;
|
|
1645 |
__pyx_L5_argtuple_error:;
|
|
1646 |
__Pyx_RaiseArgtupleInvalid("int128_to_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 36, __pyx_L3_error)
|
|
1647 |
__pyx_L3_error:;
|
|
1648 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int128_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1649 |
__Pyx_RefNannyFinishContext();
|
|
1650 |
return NULL;
|
|
1651 |
__pyx_L4_argument_unpacking_done:;
|
|
1652 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_2int128_to_quads(__pyx_self, __pyx_v_items, __pyx_v_n_items);
|
|
1653 |
|
|
1654 |
/* function exit code */
|
|
1655 |
__Pyx_RefNannyFinishContext();
|
|
1656 |
return __pyx_r;
|
|
1657 |
}
|
|
1658 |
|
|
1659 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_2int128_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
1660 |
unsigned int __pyx_v_factor;
|
|
1661 |
PyObject *__pyx_v_quad_items = NULL;
|
|
1662 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
1663 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
1664 |
PyObject *__pyx_v_x = 0;
|
|
1665 |
PyObject *__pyx_v_item = 0;
|
|
1666 |
PyObject *__pyx_r = NULL;
|
|
1667 |
__Pyx_RefNannyDeclarations
|
|
1668 |
PyObject *__pyx_t_1 = NULL;
|
|
1669 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
1670 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
1671 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
1672 |
int __pyx_t_5;
|
|
1673 |
PyObject *__pyx_t_6 = NULL;
|
|
1674 |
int __pyx_lineno = 0;
|
|
1675 |
const char *__pyx_filename = NULL;
|
|
1676 |
int __pyx_clineno = 0;
|
|
1677 |
__Pyx_RefNannySetupContext("int128_to_quads", 0);
|
|
1678 |
|
|
1679 |
/* "clickhouse_driver/columns/largeint.pyx":37
|
|
1680 |
*
|
|
1681 |
* def int128_to_quads(items, unsigned long long n_items):
|
|
1682 |
* cdef unsigned int factor = 2 # <<<<<<<<<<<<<<
|
|
1683 |
* quad_items = PyTuple_New(n_items * factor)
|
|
1684 |
*
|
|
1685 |
*/
|
|
1686 |
__pyx_v_factor = 2;
|
|
1687 |
|
|
1688 |
/* "clickhouse_driver/columns/largeint.pyx":38
|
|
1689 |
* def int128_to_quads(items, unsigned long long n_items):
|
|
1690 |
* cdef unsigned int factor = 2
|
|
1691 |
* quad_items = PyTuple_New(n_items * factor) # <<<<<<<<<<<<<<
|
|
1692 |
*
|
|
1693 |
* cdef unsigned long long i, ix
|
|
1694 |
*/
|
|
1695 |
__pyx_t_1 = PyTuple_New((__pyx_v_n_items * __pyx_v_factor)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
|
|
1696 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1697 |
__pyx_v_quad_items = ((PyObject*)__pyx_t_1);
|
|
1698 |
__pyx_t_1 = 0;
|
|
1699 |
|
|
1700 |
/* "clickhouse_driver/columns/largeint.pyx":43
|
|
1701 |
* cdef object x, item
|
|
1702 |
*
|
|
1703 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
1704 |
* ix = factor * i
|
|
1705 |
*
|
|
1706 |
*/
|
|
1707 |
__pyx_t_2 = __pyx_v_n_items;
|
|
1708 |
__pyx_t_3 = __pyx_t_2;
|
|
1709 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
1710 |
__pyx_v_i = __pyx_t_4;
|
|
1711 |
|
|
1712 |
/* "clickhouse_driver/columns/largeint.pyx":44
|
|
1713 |
*
|
|
1714 |
* for i in range(n_items):
|
|
1715 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
1716 |
*
|
|
1717 |
* x = items[i]
|
|
1718 |
*/
|
|
1719 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
1720 |
|
|
1721 |
/* "clickhouse_driver/columns/largeint.pyx":46
|
|
1722 |
* ix = factor * i
|
|
1723 |
*
|
|
1724 |
* x = items[i] # <<<<<<<<<<<<<<
|
|
1725 |
* if x < 0:
|
|
1726 |
* x = -x - 1
|
|
1727 |
*/
|
|
1728 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_items, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
|
|
1729 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1730 |
__Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
|
|
1731 |
__pyx_t_1 = 0;
|
|
1732 |
|
|
1733 |
/* "clickhouse_driver/columns/largeint.pyx":47
|
|
1734 |
*
|
|
1735 |
* x = items[i]
|
|
1736 |
* if x < 0: # <<<<<<<<<<<<<<
|
|
1737 |
* x = -x - 1
|
|
1738 |
*
|
|
1739 |
*/
|
|
1740 |
__pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
|
|
1741 |
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 47, __pyx_L1_error)
|
|
1742 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
1743 |
if (__pyx_t_5) {
|
|
1744 |
|
|
1745 |
/* "clickhouse_driver/columns/largeint.pyx":48
|
|
1746 |
* x = items[i]
|
|
1747 |
* if x < 0:
|
|
1748 |
* x = -x - 1 # <<<<<<<<<<<<<<
|
|
1749 |
*
|
|
1750 |
* item = MAX_UINT64 - x & MAX_UINT64
|
|
1751 |
*/
|
|
1752 |
__pyx_t_1 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
|
|
1753 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1754 |
__pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 48, __pyx_L1_error)
|
|
1755 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1756 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
1757 |
__Pyx_DECREF_SET(__pyx_v_x, __pyx_t_6);
|
|
1758 |
__pyx_t_6 = 0;
|
|
1759 |
|
|
1760 |
/* "clickhouse_driver/columns/largeint.pyx":50
|
|
1761 |
* x = -x - 1
|
|
1762 |
*
|
|
1763 |
* item = MAX_UINT64 - x & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
1764 |
* Py_INCREF(item)
|
|
1765 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
1766 |
*/
|
|
1767 |
__pyx_t_6 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_v_x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error)
|
|
1768 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1769 |
__pyx_t_1 = PyNumber_And(__pyx_t_6, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
|
|
1770 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1771 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1772 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
1773 |
__pyx_t_1 = 0;
|
|
1774 |
|
|
1775 |
/* "clickhouse_driver/columns/largeint.pyx":51
|
|
1776 |
*
|
|
1777 |
* item = MAX_UINT64 - x & MAX_UINT64
|
|
1778 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
1779 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
1780 |
*
|
|
1781 |
*/
|
|
1782 |
Py_INCREF(__pyx_v_item);
|
|
1783 |
|
|
1784 |
/* "clickhouse_driver/columns/largeint.pyx":52
|
|
1785 |
* item = MAX_UINT64 - x & MAX_UINT64
|
|
1786 |
* Py_INCREF(item)
|
|
1787 |
* PyTuple_SET_ITEM(quad_items, ix, item) # <<<<<<<<<<<<<<
|
|
1788 |
*
|
|
1789 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64
|
|
1790 |
*/
|
|
1791 |
PyTuple_SET_ITEM(__pyx_v_quad_items, __pyx_v_ix, __pyx_v_item);
|
|
1792 |
|
|
1793 |
/* "clickhouse_driver/columns/largeint.pyx":54
|
|
1794 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
1795 |
*
|
|
1796 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
1797 |
* Py_INCREF(item)
|
|
1798 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
1799 |
*/
|
|
1800 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
|
|
1801 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1802 |
__pyx_t_6 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error)
|
|
1803 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1804 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
1805 |
__pyx_t_1 = PyNumber_And(__pyx_t_6, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
|
|
1806 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1807 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
1808 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
1809 |
__pyx_t_1 = 0;
|
|
1810 |
|
|
1811 |
/* "clickhouse_driver/columns/largeint.pyx":55
|
|
1812 |
*
|
|
1813 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64
|
|
1814 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
1815 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
1816 |
*
|
|
1817 |
*/
|
|
1818 |
Py_INCREF(__pyx_v_item);
|
|
1819 |
|
|
1820 |
/* "clickhouse_driver/columns/largeint.pyx":56
|
|
1821 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64
|
|
1822 |
* Py_INCREF(item)
|
|
1823 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item) # <<<<<<<<<<<<<<
|
|
1824 |
*
|
|
1825 |
* else:
|
|
1826 |
*/
|
|
1827 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 1), __pyx_v_item);
|
|
1828 |
|
|
1829 |
/* "clickhouse_driver/columns/largeint.pyx":47
|
|
1830 |
*
|
|
1831 |
* x = items[i]
|
|
1832 |
* if x < 0: # <<<<<<<<<<<<<<
|
|
1833 |
* x = -x - 1
|
|
1834 |
*
|
|
1835 |
*/
|
|
1836 |
goto __pyx_L5;
|
|
1837 |
}
|
|
1838 |
|
|
1839 |
/* "clickhouse_driver/columns/largeint.pyx":59
|
|
1840 |
*
|
|
1841 |
* else:
|
|
1842 |
* item = x & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
1843 |
* Py_INCREF(item)
|
|
1844 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
1845 |
*/
|
|
1846 |
/*else*/ {
|
|
1847 |
__pyx_t_1 = PyNumber_And(__pyx_v_x, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
|
|
1848 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1849 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
1850 |
__pyx_t_1 = 0;
|
|
1851 |
|
|
1852 |
/* "clickhouse_driver/columns/largeint.pyx":60
|
|
1853 |
* else:
|
|
1854 |
* item = x & MAX_UINT64
|
|
1855 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
1856 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
1857 |
*
|
|
1858 |
*/
|
|
1859 |
Py_INCREF(__pyx_v_item);
|
|
1860 |
|
|
1861 |
/* "clickhouse_driver/columns/largeint.pyx":61
|
|
1862 |
* item = x & MAX_UINT64
|
|
1863 |
* Py_INCREF(item)
|
|
1864 |
* PyTuple_SET_ITEM(quad_items, ix, item) # <<<<<<<<<<<<<<
|
|
1865 |
*
|
|
1866 |
* item = (x >> 64) & MAX_UINT64
|
|
1867 |
*/
|
|
1868 |
PyTuple_SET_ITEM(__pyx_v_quad_items, __pyx_v_ix, __pyx_v_item);
|
|
1869 |
|
|
1870 |
/* "clickhouse_driver/columns/largeint.pyx":63
|
|
1871 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
1872 |
*
|
|
1873 |
* item = (x >> 64) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
1874 |
* Py_INCREF(item)
|
|
1875 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
1876 |
*/
|
|
1877 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
|
|
1878 |
__Pyx_GOTREF(__pyx_t_1);
|
|
1879 |
__pyx_t_6 = PyNumber_And(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error)
|
|
1880 |
__Pyx_GOTREF(__pyx_t_6);
|
|
1881 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
1882 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_6);
|
|
1883 |
__pyx_t_6 = 0;
|
|
1884 |
|
|
1885 |
/* "clickhouse_driver/columns/largeint.pyx":64
|
|
1886 |
*
|
|
1887 |
* item = (x >> 64) & MAX_UINT64
|
|
1888 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
1889 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
1890 |
*
|
|
1891 |
*/
|
|
1892 |
Py_INCREF(__pyx_v_item);
|
|
1893 |
|
|
1894 |
/* "clickhouse_driver/columns/largeint.pyx":65
|
|
1895 |
* item = (x >> 64) & MAX_UINT64
|
|
1896 |
* Py_INCREF(item)
|
|
1897 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item) # <<<<<<<<<<<<<<
|
|
1898 |
*
|
|
1899 |
* return quad_items
|
|
1900 |
*/
|
|
1901 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 1), __pyx_v_item);
|
|
1902 |
}
|
|
1903 |
__pyx_L5:;
|
|
1904 |
}
|
|
1905 |
|
|
1906 |
/* "clickhouse_driver/columns/largeint.pyx":67
|
|
1907 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
1908 |
*
|
|
1909 |
* return quad_items # <<<<<<<<<<<<<<
|
|
1910 |
*
|
|
1911 |
*
|
|
1912 |
*/
|
|
1913 |
__Pyx_XDECREF(__pyx_r);
|
|
1914 |
__Pyx_INCREF(__pyx_v_quad_items);
|
|
1915 |
__pyx_r = __pyx_v_quad_items;
|
|
1916 |
goto __pyx_L0;
|
|
1917 |
|
|
1918 |
/* "clickhouse_driver/columns/largeint.pyx":36
|
|
1919 |
*
|
|
1920 |
*
|
|
1921 |
* def int128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
1922 |
* cdef unsigned int factor = 2
|
|
1923 |
* quad_items = PyTuple_New(n_items * factor)
|
|
1924 |
*/
|
|
1925 |
|
|
1926 |
/* function exit code */
|
|
1927 |
__pyx_L1_error:;
|
|
1928 |
__Pyx_XDECREF(__pyx_t_1);
|
|
1929 |
__Pyx_XDECREF(__pyx_t_6);
|
|
1930 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int128_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1931 |
__pyx_r = NULL;
|
|
1932 |
__pyx_L0:;
|
|
1933 |
__Pyx_XDECREF(__pyx_v_quad_items);
|
|
1934 |
__Pyx_XDECREF(__pyx_v_x);
|
|
1935 |
__Pyx_XDECREF(__pyx_v_item);
|
|
1936 |
__Pyx_XGIVEREF(__pyx_r);
|
|
1937 |
__Pyx_RefNannyFinishContext();
|
|
1938 |
return __pyx_r;
|
|
1939 |
}
|
|
1940 |
|
|
1941 |
/* "clickhouse_driver/columns/largeint.pyx":70
|
|
1942 |
*
|
|
1943 |
*
|
|
1944 |
* def uint128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
1945 |
* cdef unsigned int factor = 2
|
|
1946 |
* items = PyTuple_New(n_items)
|
|
1947 |
*/
|
|
1948 |
|
|
1949 |
/* Python wrapper */
|
|
1950 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_5uint128_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
1951 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_5uint128_from_quads = {"uint128_from_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_5uint128_from_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
1952 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_5uint128_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
1953 |
PyObject *__pyx_v_quad_items = 0;
|
|
1954 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
1955 |
int __pyx_lineno = 0;
|
|
1956 |
const char *__pyx_filename = NULL;
|
|
1957 |
int __pyx_clineno = 0;
|
|
1958 |
PyObject *__pyx_r = 0;
|
|
1959 |
__Pyx_RefNannyDeclarations
|
|
1960 |
__Pyx_RefNannySetupContext("uint128_from_quads (wrapper)", 0);
|
|
1961 |
{
|
|
1962 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_quad_items,&__pyx_n_s_n_items,0};
|
|
1963 |
PyObject* values[2] = {0,0};
|
|
1964 |
if (unlikely(__pyx_kwds)) {
|
|
1965 |
Py_ssize_t kw_args;
|
|
1966 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
1967 |
switch (pos_args) {
|
|
1968 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
1969 |
CYTHON_FALLTHROUGH;
|
|
1970 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
1971 |
CYTHON_FALLTHROUGH;
|
|
1972 |
case 0: break;
|
|
1973 |
default: goto __pyx_L5_argtuple_error;
|
|
1974 |
}
|
|
1975 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
1976 |
switch (pos_args) {
|
|
1977 |
case 0:
|
|
1978 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quad_items)) != 0)) kw_args--;
|
|
1979 |
else goto __pyx_L5_argtuple_error;
|
|
1980 |
CYTHON_FALLTHROUGH;
|
|
1981 |
case 1:
|
|
1982 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
1983 |
else {
|
|
1984 |
__Pyx_RaiseArgtupleInvalid("uint128_from_quads", 1, 2, 2, 1); __PYX_ERR(0, 70, __pyx_L3_error)
|
|
1985 |
}
|
|
1986 |
}
|
|
1987 |
if (unlikely(kw_args > 0)) {
|
|
1988 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uint128_from_quads") < 0)) __PYX_ERR(0, 70, __pyx_L3_error)
|
|
1989 |
}
|
|
1990 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
1991 |
goto __pyx_L5_argtuple_error;
|
|
1992 |
} else {
|
|
1993 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
1994 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
1995 |
}
|
|
1996 |
__pyx_v_quad_items = values[0];
|
|
1997 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 70, __pyx_L3_error)
|
|
1998 |
}
|
|
1999 |
goto __pyx_L4_argument_unpacking_done;
|
|
2000 |
__pyx_L5_argtuple_error:;
|
|
2001 |
__Pyx_RaiseArgtupleInvalid("uint128_from_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 70, __pyx_L3_error)
|
|
2002 |
__pyx_L3_error:;
|
|
2003 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint128_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2004 |
__Pyx_RefNannyFinishContext();
|
|
2005 |
return NULL;
|
|
2006 |
__pyx_L4_argument_unpacking_done:;
|
|
2007 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_4uint128_from_quads(__pyx_self, __pyx_v_quad_items, __pyx_v_n_items);
|
|
2008 |
|
|
2009 |
/* function exit code */
|
|
2010 |
__Pyx_RefNannyFinishContext();
|
|
2011 |
return __pyx_r;
|
|
2012 |
}
|
|
2013 |
|
|
2014 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_4uint128_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
2015 |
unsigned int __pyx_v_factor;
|
|
2016 |
PyObject *__pyx_v_items = NULL;
|
|
2017 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
2018 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
2019 |
PyObject *__pyx_v_item = 0;
|
|
2020 |
PyObject *__pyx_r = NULL;
|
|
2021 |
__Pyx_RefNannyDeclarations
|
|
2022 |
PyObject *__pyx_t_1 = NULL;
|
|
2023 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
2024 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
2025 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
2026 |
unsigned PY_LONG_LONG __pyx_t_5;
|
|
2027 |
PyObject *__pyx_t_6 = NULL;
|
|
2028 |
PyObject *__pyx_t_7 = NULL;
|
|
2029 |
int __pyx_lineno = 0;
|
|
2030 |
const char *__pyx_filename = NULL;
|
|
2031 |
int __pyx_clineno = 0;
|
|
2032 |
__Pyx_RefNannySetupContext("uint128_from_quads", 0);
|
|
2033 |
|
|
2034 |
/* "clickhouse_driver/columns/largeint.pyx":71
|
|
2035 |
*
|
|
2036 |
* def uint128_from_quads(quad_items, unsigned long long n_items):
|
|
2037 |
* cdef unsigned int factor = 2 # <<<<<<<<<<<<<<
|
|
2038 |
* items = PyTuple_New(n_items)
|
|
2039 |
*
|
|
2040 |
*/
|
|
2041 |
__pyx_v_factor = 2;
|
|
2042 |
|
|
2043 |
/* "clickhouse_driver/columns/largeint.pyx":72
|
|
2044 |
* def uint128_from_quads(quad_items, unsigned long long n_items):
|
|
2045 |
* cdef unsigned int factor = 2
|
|
2046 |
* items = PyTuple_New(n_items) # <<<<<<<<<<<<<<
|
|
2047 |
*
|
|
2048 |
* cdef unsigned long long i, ix
|
|
2049 |
*/
|
|
2050 |
__pyx_t_1 = PyTuple_New(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
|
|
2051 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2052 |
__pyx_v_items = ((PyObject*)__pyx_t_1);
|
|
2053 |
__pyx_t_1 = 0;
|
|
2054 |
|
|
2055 |
/* "clickhouse_driver/columns/largeint.pyx":77
|
|
2056 |
* cdef object item
|
|
2057 |
*
|
|
2058 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
2059 |
* ix = factor * i
|
|
2060 |
* item = (quad_items[ix + 1] << 64) + quad_items[ix]
|
|
2061 |
*/
|
|
2062 |
__pyx_t_2 = __pyx_v_n_items;
|
|
2063 |
__pyx_t_3 = __pyx_t_2;
|
|
2064 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
2065 |
__pyx_v_i = __pyx_t_4;
|
|
2066 |
|
|
2067 |
/* "clickhouse_driver/columns/largeint.pyx":78
|
|
2068 |
*
|
|
2069 |
* for i in range(n_items):
|
|
2070 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
2071 |
* item = (quad_items[ix + 1] << 64) + quad_items[ix]
|
|
2072 |
*
|
|
2073 |
*/
|
|
2074 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
2075 |
|
|
2076 |
/* "clickhouse_driver/columns/largeint.pyx":79
|
|
2077 |
* for i in range(n_items):
|
|
2078 |
* ix = factor * i
|
|
2079 |
* item = (quad_items[ix + 1] << 64) + quad_items[ix] # <<<<<<<<<<<<<<
|
|
2080 |
*
|
|
2081 |
* Py_INCREF(item)
|
|
2082 |
*/
|
|
2083 |
__pyx_t_5 = (__pyx_v_ix + 1);
|
|
2084 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
|
|
2085 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2086 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L1_error)
|
|
2087 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2088 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2089 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_v_ix, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
|
|
2090 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2091 |
__pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L1_error)
|
|
2092 |
__Pyx_GOTREF(__pyx_t_7);
|
|
2093 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2094 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2095 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
|
|
2096 |
__pyx_t_7 = 0;
|
|
2097 |
|
|
2098 |
/* "clickhouse_driver/columns/largeint.pyx":81
|
|
2099 |
* item = (quad_items[ix + 1] << 64) + quad_items[ix]
|
|
2100 |
*
|
|
2101 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
2102 |
* PyTuple_SET_ITEM(items, i, item)
|
|
2103 |
*
|
|
2104 |
*/
|
|
2105 |
Py_INCREF(__pyx_v_item);
|
|
2106 |
|
|
2107 |
/* "clickhouse_driver/columns/largeint.pyx":82
|
|
2108 |
*
|
|
2109 |
* Py_INCREF(item)
|
|
2110 |
* PyTuple_SET_ITEM(items, i, item) # <<<<<<<<<<<<<<
|
|
2111 |
*
|
|
2112 |
* return items
|
|
2113 |
*/
|
|
2114 |
PyTuple_SET_ITEM(__pyx_v_items, __pyx_v_i, __pyx_v_item);
|
|
2115 |
}
|
|
2116 |
|
|
2117 |
/* "clickhouse_driver/columns/largeint.pyx":84
|
|
2118 |
* PyTuple_SET_ITEM(items, i, item)
|
|
2119 |
*
|
|
2120 |
* return items # <<<<<<<<<<<<<<
|
|
2121 |
*
|
|
2122 |
*
|
|
2123 |
*/
|
|
2124 |
__Pyx_XDECREF(__pyx_r);
|
|
2125 |
__Pyx_INCREF(__pyx_v_items);
|
|
2126 |
__pyx_r = __pyx_v_items;
|
|
2127 |
goto __pyx_L0;
|
|
2128 |
|
|
2129 |
/* "clickhouse_driver/columns/largeint.pyx":70
|
|
2130 |
*
|
|
2131 |
*
|
|
2132 |
* def uint128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
2133 |
* cdef unsigned int factor = 2
|
|
2134 |
* items = PyTuple_New(n_items)
|
|
2135 |
*/
|
|
2136 |
|
|
2137 |
/* function exit code */
|
|
2138 |
__pyx_L1_error:;
|
|
2139 |
__Pyx_XDECREF(__pyx_t_1);
|
|
2140 |
__Pyx_XDECREF(__pyx_t_6);
|
|
2141 |
__Pyx_XDECREF(__pyx_t_7);
|
|
2142 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint128_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2143 |
__pyx_r = NULL;
|
|
2144 |
__pyx_L0:;
|
|
2145 |
__Pyx_XDECREF(__pyx_v_items);
|
|
2146 |
__Pyx_XDECREF(__pyx_v_item);
|
|
2147 |
__Pyx_XGIVEREF(__pyx_r);
|
|
2148 |
__Pyx_RefNannyFinishContext();
|
|
2149 |
return __pyx_r;
|
|
2150 |
}
|
|
2151 |
|
|
2152 |
/* "clickhouse_driver/columns/largeint.pyx":87
|
|
2153 |
*
|
|
2154 |
*
|
|
2155 |
* def uint128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
2156 |
* cdef unsigned int factor = 2
|
|
2157 |
* quad_items = PyTuple_New(n_items * factor)
|
|
2158 |
*/
|
|
2159 |
|
|
2160 |
/* Python wrapper */
|
|
2161 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_7uint128_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
2162 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_7uint128_to_quads = {"uint128_to_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_7uint128_to_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
2163 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_7uint128_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
2164 |
PyObject *__pyx_v_items = 0;
|
|
2165 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
2166 |
int __pyx_lineno = 0;
|
|
2167 |
const char *__pyx_filename = NULL;
|
|
2168 |
int __pyx_clineno = 0;
|
|
2169 |
PyObject *__pyx_r = 0;
|
|
2170 |
__Pyx_RefNannyDeclarations
|
|
2171 |
__Pyx_RefNannySetupContext("uint128_to_quads (wrapper)", 0);
|
|
2172 |
{
|
|
2173 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,&__pyx_n_s_n_items,0};
|
|
2174 |
PyObject* values[2] = {0,0};
|
|
2175 |
if (unlikely(__pyx_kwds)) {
|
|
2176 |
Py_ssize_t kw_args;
|
|
2177 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
2178 |
switch (pos_args) {
|
|
2179 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
2180 |
CYTHON_FALLTHROUGH;
|
|
2181 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
2182 |
CYTHON_FALLTHROUGH;
|
|
2183 |
case 0: break;
|
|
2184 |
default: goto __pyx_L5_argtuple_error;
|
|
2185 |
}
|
|
2186 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
2187 |
switch (pos_args) {
|
|
2188 |
case 0:
|
|
2189 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items)) != 0)) kw_args--;
|
|
2190 |
else goto __pyx_L5_argtuple_error;
|
|
2191 |
CYTHON_FALLTHROUGH;
|
|
2192 |
case 1:
|
|
2193 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
2194 |
else {
|
|
2195 |
__Pyx_RaiseArgtupleInvalid("uint128_to_quads", 1, 2, 2, 1); __PYX_ERR(0, 87, __pyx_L3_error)
|
|
2196 |
}
|
|
2197 |
}
|
|
2198 |
if (unlikely(kw_args > 0)) {
|
|
2199 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uint128_to_quads") < 0)) __PYX_ERR(0, 87, __pyx_L3_error)
|
|
2200 |
}
|
|
2201 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
2202 |
goto __pyx_L5_argtuple_error;
|
|
2203 |
} else {
|
|
2204 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
2205 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
2206 |
}
|
|
2207 |
__pyx_v_items = values[0];
|
|
2208 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
|
|
2209 |
}
|
|
2210 |
goto __pyx_L4_argument_unpacking_done;
|
|
2211 |
__pyx_L5_argtuple_error:;
|
|
2212 |
__Pyx_RaiseArgtupleInvalid("uint128_to_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 87, __pyx_L3_error)
|
|
2213 |
__pyx_L3_error:;
|
|
2214 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint128_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2215 |
__Pyx_RefNannyFinishContext();
|
|
2216 |
return NULL;
|
|
2217 |
__pyx_L4_argument_unpacking_done:;
|
|
2218 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_6uint128_to_quads(__pyx_self, __pyx_v_items, __pyx_v_n_items);
|
|
2219 |
|
|
2220 |
/* function exit code */
|
|
2221 |
__Pyx_RefNannyFinishContext();
|
|
2222 |
return __pyx_r;
|
|
2223 |
}
|
|
2224 |
|
|
2225 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_6uint128_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
2226 |
unsigned int __pyx_v_factor;
|
|
2227 |
PyObject *__pyx_v_quad_items = NULL;
|
|
2228 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
2229 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
2230 |
PyObject *__pyx_v_x = 0;
|
|
2231 |
PyObject *__pyx_v_item = 0;
|
|
2232 |
PyObject *__pyx_r = NULL;
|
|
2233 |
__Pyx_RefNannyDeclarations
|
|
2234 |
PyObject *__pyx_t_1 = NULL;
|
|
2235 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
2236 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
2237 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
2238 |
PyObject *__pyx_t_5 = NULL;
|
|
2239 |
int __pyx_lineno = 0;
|
|
2240 |
const char *__pyx_filename = NULL;
|
|
2241 |
int __pyx_clineno = 0;
|
|
2242 |
__Pyx_RefNannySetupContext("uint128_to_quads", 0);
|
|
2243 |
|
|
2244 |
/* "clickhouse_driver/columns/largeint.pyx":88
|
|
2245 |
*
|
|
2246 |
* def uint128_to_quads(items, unsigned long long n_items):
|
|
2247 |
* cdef unsigned int factor = 2 # <<<<<<<<<<<<<<
|
|
2248 |
* quad_items = PyTuple_New(n_items * factor)
|
|
2249 |
*
|
|
2250 |
*/
|
|
2251 |
__pyx_v_factor = 2;
|
|
2252 |
|
|
2253 |
/* "clickhouse_driver/columns/largeint.pyx":89
|
|
2254 |
* def uint128_to_quads(items, unsigned long long n_items):
|
|
2255 |
* cdef unsigned int factor = 2
|
|
2256 |
* quad_items = PyTuple_New(n_items * factor) # <<<<<<<<<<<<<<
|
|
2257 |
*
|
|
2258 |
* cdef unsigned long long i, ix
|
|
2259 |
*/
|
|
2260 |
__pyx_t_1 = PyTuple_New((__pyx_v_n_items * __pyx_v_factor)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
|
|
2261 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2262 |
__pyx_v_quad_items = ((PyObject*)__pyx_t_1);
|
|
2263 |
__pyx_t_1 = 0;
|
|
2264 |
|
|
2265 |
/* "clickhouse_driver/columns/largeint.pyx":94
|
|
2266 |
* cdef object x, item
|
|
2267 |
*
|
|
2268 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
2269 |
* ix = factor * i
|
|
2270 |
*
|
|
2271 |
*/
|
|
2272 |
__pyx_t_2 = __pyx_v_n_items;
|
|
2273 |
__pyx_t_3 = __pyx_t_2;
|
|
2274 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
2275 |
__pyx_v_i = __pyx_t_4;
|
|
2276 |
|
|
2277 |
/* "clickhouse_driver/columns/largeint.pyx":95
|
|
2278 |
*
|
|
2279 |
* for i in range(n_items):
|
|
2280 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
2281 |
*
|
|
2282 |
* x = items[i]
|
|
2283 |
*/
|
|
2284 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
2285 |
|
|
2286 |
/* "clickhouse_driver/columns/largeint.pyx":97
|
|
2287 |
* ix = factor * i
|
|
2288 |
*
|
|
2289 |
* x = items[i] # <<<<<<<<<<<<<<
|
|
2290 |
* item = x & MAX_UINT64
|
|
2291 |
* Py_INCREF(item)
|
|
2292 |
*/
|
|
2293 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_items, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
|
|
2294 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2295 |
__Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
|
|
2296 |
__pyx_t_1 = 0;
|
|
2297 |
|
|
2298 |
/* "clickhouse_driver/columns/largeint.pyx":98
|
|
2299 |
*
|
|
2300 |
* x = items[i]
|
|
2301 |
* item = x & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
2302 |
* Py_INCREF(item)
|
|
2303 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
2304 |
*/
|
|
2305 |
__pyx_t_1 = PyNumber_And(__pyx_v_x, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
|
|
2306 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2307 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
2308 |
__pyx_t_1 = 0;
|
|
2309 |
|
|
2310 |
/* "clickhouse_driver/columns/largeint.pyx":99
|
|
2311 |
* x = items[i]
|
|
2312 |
* item = x & MAX_UINT64
|
|
2313 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
2314 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
2315 |
*
|
|
2316 |
*/
|
|
2317 |
Py_INCREF(__pyx_v_item);
|
|
2318 |
|
|
2319 |
/* "clickhouse_driver/columns/largeint.pyx":100
|
|
2320 |
* item = x & MAX_UINT64
|
|
2321 |
* Py_INCREF(item)
|
|
2322 |
* PyTuple_SET_ITEM(quad_items, ix, item) # <<<<<<<<<<<<<<
|
|
2323 |
*
|
|
2324 |
* item = (x >> 64) & MAX_UINT64
|
|
2325 |
*/
|
|
2326 |
PyTuple_SET_ITEM(__pyx_v_quad_items, __pyx_v_ix, __pyx_v_item);
|
|
2327 |
|
|
2328 |
/* "clickhouse_driver/columns/largeint.pyx":102
|
|
2329 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
2330 |
*
|
|
2331 |
* item = (x >> 64) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
2332 |
* Py_INCREF(item)
|
|
2333 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
2334 |
*/
|
|
2335 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
|
|
2336 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2337 |
__pyx_t_5 = PyNumber_And(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error)
|
|
2338 |
__Pyx_GOTREF(__pyx_t_5);
|
|
2339 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2340 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_5);
|
|
2341 |
__pyx_t_5 = 0;
|
|
2342 |
|
|
2343 |
/* "clickhouse_driver/columns/largeint.pyx":103
|
|
2344 |
*
|
|
2345 |
* item = (x >> 64) & MAX_UINT64
|
|
2346 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
2347 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
2348 |
*
|
|
2349 |
*/
|
|
2350 |
Py_INCREF(__pyx_v_item);
|
|
2351 |
|
|
2352 |
/* "clickhouse_driver/columns/largeint.pyx":104
|
|
2353 |
* item = (x >> 64) & MAX_UINT64
|
|
2354 |
* Py_INCREF(item)
|
|
2355 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item) # <<<<<<<<<<<<<<
|
|
2356 |
*
|
|
2357 |
* return quad_items
|
|
2358 |
*/
|
|
2359 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 1), __pyx_v_item);
|
|
2360 |
}
|
|
2361 |
|
|
2362 |
/* "clickhouse_driver/columns/largeint.pyx":106
|
|
2363 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
2364 |
*
|
|
2365 |
* return quad_items # <<<<<<<<<<<<<<
|
|
2366 |
*
|
|
2367 |
* # 256 bits
|
|
2368 |
*/
|
|
2369 |
__Pyx_XDECREF(__pyx_r);
|
|
2370 |
__Pyx_INCREF(__pyx_v_quad_items);
|
|
2371 |
__pyx_r = __pyx_v_quad_items;
|
|
2372 |
goto __pyx_L0;
|
|
2373 |
|
|
2374 |
/* "clickhouse_driver/columns/largeint.pyx":87
|
|
2375 |
*
|
|
2376 |
*
|
|
2377 |
* def uint128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
2378 |
* cdef unsigned int factor = 2
|
|
2379 |
* quad_items = PyTuple_New(n_items * factor)
|
|
2380 |
*/
|
|
2381 |
|
|
2382 |
/* function exit code */
|
|
2383 |
__pyx_L1_error:;
|
|
2384 |
__Pyx_XDECREF(__pyx_t_1);
|
|
2385 |
__Pyx_XDECREF(__pyx_t_5);
|
|
2386 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint128_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2387 |
__pyx_r = NULL;
|
|
2388 |
__pyx_L0:;
|
|
2389 |
__Pyx_XDECREF(__pyx_v_quad_items);
|
|
2390 |
__Pyx_XDECREF(__pyx_v_x);
|
|
2391 |
__Pyx_XDECREF(__pyx_v_item);
|
|
2392 |
__Pyx_XGIVEREF(__pyx_r);
|
|
2393 |
__Pyx_RefNannyFinishContext();
|
|
2394 |
return __pyx_r;
|
|
2395 |
}
|
|
2396 |
|
|
2397 |
/* "clickhouse_driver/columns/largeint.pyx":111
|
|
2398 |
*
|
|
2399 |
*
|
|
2400 |
* def int256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
2401 |
* cdef unsigned int factor = 4
|
|
2402 |
* items = PyTuple_New(n_items)
|
|
2403 |
*/
|
|
2404 |
|
|
2405 |
/* Python wrapper */
|
|
2406 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_9int256_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
2407 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_9int256_from_quads = {"int256_from_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_9int256_from_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
2408 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_9int256_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
2409 |
PyObject *__pyx_v_quad_items = 0;
|
|
2410 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
2411 |
int __pyx_lineno = 0;
|
|
2412 |
const char *__pyx_filename = NULL;
|
|
2413 |
int __pyx_clineno = 0;
|
|
2414 |
PyObject *__pyx_r = 0;
|
|
2415 |
__Pyx_RefNannyDeclarations
|
|
2416 |
__Pyx_RefNannySetupContext("int256_from_quads (wrapper)", 0);
|
|
2417 |
{
|
|
2418 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_quad_items,&__pyx_n_s_n_items,0};
|
|
2419 |
PyObject* values[2] = {0,0};
|
|
2420 |
if (unlikely(__pyx_kwds)) {
|
|
2421 |
Py_ssize_t kw_args;
|
|
2422 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
2423 |
switch (pos_args) {
|
|
2424 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
2425 |
CYTHON_FALLTHROUGH;
|
|
2426 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
2427 |
CYTHON_FALLTHROUGH;
|
|
2428 |
case 0: break;
|
|
2429 |
default: goto __pyx_L5_argtuple_error;
|
|
2430 |
}
|
|
2431 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
2432 |
switch (pos_args) {
|
|
2433 |
case 0:
|
|
2434 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quad_items)) != 0)) kw_args--;
|
|
2435 |
else goto __pyx_L5_argtuple_error;
|
|
2436 |
CYTHON_FALLTHROUGH;
|
|
2437 |
case 1:
|
|
2438 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
2439 |
else {
|
|
2440 |
__Pyx_RaiseArgtupleInvalid("int256_from_quads", 1, 2, 2, 1); __PYX_ERR(0, 111, __pyx_L3_error)
|
|
2441 |
}
|
|
2442 |
}
|
|
2443 |
if (unlikely(kw_args > 0)) {
|
|
2444 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "int256_from_quads") < 0)) __PYX_ERR(0, 111, __pyx_L3_error)
|
|
2445 |
}
|
|
2446 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
2447 |
goto __pyx_L5_argtuple_error;
|
|
2448 |
} else {
|
|
2449 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
2450 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
2451 |
}
|
|
2452 |
__pyx_v_quad_items = values[0];
|
|
2453 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L3_error)
|
|
2454 |
}
|
|
2455 |
goto __pyx_L4_argument_unpacking_done;
|
|
2456 |
__pyx_L5_argtuple_error:;
|
|
2457 |
__Pyx_RaiseArgtupleInvalid("int256_from_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 111, __pyx_L3_error)
|
|
2458 |
__pyx_L3_error:;
|
|
2459 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int256_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2460 |
__Pyx_RefNannyFinishContext();
|
|
2461 |
return NULL;
|
|
2462 |
__pyx_L4_argument_unpacking_done:;
|
|
2463 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_8int256_from_quads(__pyx_self, __pyx_v_quad_items, __pyx_v_n_items);
|
|
2464 |
|
|
2465 |
/* function exit code */
|
|
2466 |
__Pyx_RefNannyFinishContext();
|
|
2467 |
return __pyx_r;
|
|
2468 |
}
|
|
2469 |
|
|
2470 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_8int256_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
2471 |
unsigned int __pyx_v_factor;
|
|
2472 |
PyObject *__pyx_v_items = NULL;
|
|
2473 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
2474 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
2475 |
PyObject *__pyx_v_item = 0;
|
|
2476 |
PyObject *__pyx_r = NULL;
|
|
2477 |
__Pyx_RefNannyDeclarations
|
|
2478 |
PyObject *__pyx_t_1 = NULL;
|
|
2479 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
2480 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
2481 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
2482 |
unsigned PY_LONG_LONG __pyx_t_5;
|
|
2483 |
PyObject *__pyx_t_6 = NULL;
|
|
2484 |
int __pyx_t_7;
|
|
2485 |
PyObject *__pyx_t_8 = NULL;
|
|
2486 |
int __pyx_lineno = 0;
|
|
2487 |
const char *__pyx_filename = NULL;
|
|
2488 |
int __pyx_clineno = 0;
|
|
2489 |
__Pyx_RefNannySetupContext("int256_from_quads", 0);
|
|
2490 |
|
|
2491 |
/* "clickhouse_driver/columns/largeint.pyx":112
|
|
2492 |
*
|
|
2493 |
* def int256_from_quads(quad_items, unsigned long long n_items):
|
|
2494 |
* cdef unsigned int factor = 4 # <<<<<<<<<<<<<<
|
|
2495 |
* items = PyTuple_New(n_items)
|
|
2496 |
*
|
|
2497 |
*/
|
|
2498 |
__pyx_v_factor = 4;
|
|
2499 |
|
|
2500 |
/* "clickhouse_driver/columns/largeint.pyx":113
|
|
2501 |
* def int256_from_quads(quad_items, unsigned long long n_items):
|
|
2502 |
* cdef unsigned int factor = 4
|
|
2503 |
* items = PyTuple_New(n_items) # <<<<<<<<<<<<<<
|
|
2504 |
*
|
|
2505 |
* cdef unsigned long long i, ix
|
|
2506 |
*/
|
|
2507 |
__pyx_t_1 = PyTuple_New(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
|
|
2508 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2509 |
__pyx_v_items = ((PyObject*)__pyx_t_1);
|
|
2510 |
__pyx_t_1 = 0;
|
|
2511 |
|
|
2512 |
/* "clickhouse_driver/columns/largeint.pyx":118
|
|
2513 |
* cdef object item
|
|
2514 |
*
|
|
2515 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
2516 |
* ix = factor * i
|
|
2517 |
*
|
|
2518 |
*/
|
|
2519 |
__pyx_t_2 = __pyx_v_n_items;
|
|
2520 |
__pyx_t_3 = __pyx_t_2;
|
|
2521 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
2522 |
__pyx_v_i = __pyx_t_4;
|
|
2523 |
|
|
2524 |
/* "clickhouse_driver/columns/largeint.pyx":119
|
|
2525 |
*
|
|
2526 |
* for i in range(n_items):
|
|
2527 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
2528 |
*
|
|
2529 |
* if quad_items[ix + 3] > MAX_INT64:
|
|
2530 |
*/
|
|
2531 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
2532 |
|
|
2533 |
/* "clickhouse_driver/columns/largeint.pyx":121
|
|
2534 |
* ix = factor * i
|
|
2535 |
*
|
|
2536 |
* if quad_items[ix + 3] > MAX_INT64: # <<<<<<<<<<<<<<
|
|
2537 |
* item = (
|
|
2538 |
* -((MAX_UINT64 - quad_items[ix + 3]) << 192)
|
|
2539 |
*/
|
|
2540 |
__pyx_t_5 = (__pyx_v_ix + 3);
|
|
2541 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
2542 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2543 |
__pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_INT64, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
2544 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2545 |
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
2546 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2547 |
if (__pyx_t_7) {
|
|
2548 |
|
|
2549 |
/* "clickhouse_driver/columns/largeint.pyx":123
|
|
2550 |
* if quad_items[ix + 3] > MAX_INT64:
|
|
2551 |
* item = (
|
|
2552 |
* -((MAX_UINT64 - quad_items[ix + 3]) << 192) # <<<<<<<<<<<<<<
|
|
2553 |
* -((MAX_UINT64 - quad_items[ix + 2]) << 128)
|
|
2554 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
2555 |
*/
|
|
2556 |
__pyx_t_5 = (__pyx_v_ix + 3);
|
|
2557 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L1_error)
|
|
2558 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2559 |
__pyx_t_1 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
|
|
2560 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2561 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2562 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_1, __pyx_int_192); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L1_error)
|
|
2563 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2564 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2565 |
__pyx_t_1 = PyNumber_Negative(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
|
|
2566 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2567 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2568 |
|
|
2569 |
/* "clickhouse_driver/columns/largeint.pyx":124
|
|
2570 |
* item = (
|
|
2571 |
* -((MAX_UINT64 - quad_items[ix + 3]) << 192)
|
|
2572 |
* -((MAX_UINT64 - quad_items[ix + 2]) << 128) # <<<<<<<<<<<<<<
|
|
2573 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
2574 |
* - (MAX_UINT64 - quad_items[ix])
|
|
2575 |
*/
|
|
2576 |
__pyx_t_5 = (__pyx_v_ix + 2);
|
|
2577 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
|
|
2578 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2579 |
__pyx_t_8 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error)
|
|
2580 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2581 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2582 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_8, __pyx_int_128); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
|
|
2583 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2584 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
2585 |
__pyx_t_8 = PyNumber_Subtract(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error)
|
|
2586 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2587 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2588 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2589 |
|
|
2590 |
/* "clickhouse_driver/columns/largeint.pyx":125
|
|
2591 |
* -((MAX_UINT64 - quad_items[ix + 3]) << 192)
|
|
2592 |
* -((MAX_UINT64 - quad_items[ix + 2]) << 128)
|
|
2593 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64) # <<<<<<<<<<<<<<
|
|
2594 |
* - (MAX_UINT64 - quad_items[ix])
|
|
2595 |
* - 1
|
|
2596 |
*/
|
|
2597 |
__pyx_t_5 = (__pyx_v_ix + 1);
|
|
2598 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
2599 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2600 |
__pyx_t_1 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
2601 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2602 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2603 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
2604 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2605 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2606 |
__pyx_t_1 = PyNumber_Subtract(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
2607 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2608 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
2609 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2610 |
|
|
2611 |
/* "clickhouse_driver/columns/largeint.pyx":126
|
|
2612 |
* -((MAX_UINT64 - quad_items[ix + 2]) << 128)
|
|
2613 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
2614 |
* - (MAX_UINT64 - quad_items[ix]) # <<<<<<<<<<<<<<
|
|
2615 |
* - 1
|
|
2616 |
* )
|
|
2617 |
*/
|
|
2618 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_v_ix, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
2619 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2620 |
__pyx_t_8 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
2621 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2622 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2623 |
__pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
2624 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2625 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2626 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
2627 |
|
|
2628 |
/* "clickhouse_driver/columns/largeint.pyx":127
|
|
2629 |
* -((MAX_UINT64 - quad_items[ix + 1]) << 64)
|
|
2630 |
* - (MAX_UINT64 - quad_items[ix])
|
|
2631 |
* - 1 # <<<<<<<<<<<<<<
|
|
2632 |
* )
|
|
2633 |
*
|
|
2634 |
*/
|
|
2635 |
__pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 127, __pyx_L1_error)
|
|
2636 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2637 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2638 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
|
|
2639 |
__pyx_t_8 = 0;
|
|
2640 |
|
|
2641 |
/* "clickhouse_driver/columns/largeint.pyx":121
|
|
2642 |
* ix = factor * i
|
|
2643 |
*
|
|
2644 |
* if quad_items[ix + 3] > MAX_INT64: # <<<<<<<<<<<<<<
|
|
2645 |
* item = (
|
|
2646 |
* -((MAX_UINT64 - quad_items[ix + 3]) << 192)
|
|
2647 |
*/
|
|
2648 |
goto __pyx_L5;
|
|
2649 |
}
|
|
2650 |
|
|
2651 |
/* "clickhouse_driver/columns/largeint.pyx":134
|
|
2652 |
* (quad_items[ix + 3] << 192) +
|
|
2653 |
* (quad_items[ix + 2] << 128) +
|
|
2654 |
* (quad_items[ix + 1] << 64) + # <<<<<<<<<<<<<<
|
|
2655 |
* quad_items[ix]
|
|
2656 |
* )
|
|
2657 |
*/
|
|
2658 |
/*else*/ {
|
|
2659 |
|
|
2660 |
/* "clickhouse_driver/columns/largeint.pyx":132
|
|
2661 |
* else:
|
|
2662 |
* item = (
|
|
2663 |
* (quad_items[ix + 3] << 192) + # <<<<<<<<<<<<<<
|
|
2664 |
* (quad_items[ix + 2] << 128) +
|
|
2665 |
* (quad_items[ix + 1] << 64) +
|
|
2666 |
*/
|
|
2667 |
__pyx_t_5 = (__pyx_v_ix + 3);
|
|
2668 |
__pyx_t_8 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
2669 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2670 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_8, __pyx_int_192); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
2671 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2672 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
2673 |
|
|
2674 |
/* "clickhouse_driver/columns/largeint.pyx":133
|
|
2675 |
* item = (
|
|
2676 |
* (quad_items[ix + 3] << 192) +
|
|
2677 |
* (quad_items[ix + 2] << 128) + # <<<<<<<<<<<<<<
|
|
2678 |
* (quad_items[ix + 1] << 64) +
|
|
2679 |
* quad_items[ix]
|
|
2680 |
*/
|
|
2681 |
__pyx_t_5 = (__pyx_v_ix + 2);
|
|
2682 |
__pyx_t_8 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error)
|
|
2683 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2684 |
__pyx_t_1 = PyNumber_Lshift(__pyx_t_8, __pyx_int_128); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
|
|
2685 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2686 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
2687 |
|
|
2688 |
/* "clickhouse_driver/columns/largeint.pyx":132
|
|
2689 |
* else:
|
|
2690 |
* item = (
|
|
2691 |
* (quad_items[ix + 3] << 192) + # <<<<<<<<<<<<<<
|
|
2692 |
* (quad_items[ix + 2] << 128) +
|
|
2693 |
* (quad_items[ix + 1] << 64) +
|
|
2694 |
*/
|
|
2695 |
__pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
2696 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2697 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2698 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2699 |
|
|
2700 |
/* "clickhouse_driver/columns/largeint.pyx":134
|
|
2701 |
* (quad_items[ix + 3] << 192) +
|
|
2702 |
* (quad_items[ix + 2] << 128) +
|
|
2703 |
* (quad_items[ix + 1] << 64) + # <<<<<<<<<<<<<<
|
|
2704 |
* quad_items[ix]
|
|
2705 |
* )
|
|
2706 |
*/
|
|
2707 |
__pyx_t_5 = (__pyx_v_ix + 1);
|
|
2708 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
2709 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2710 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
2711 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2712 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2713 |
|
|
2714 |
/* "clickhouse_driver/columns/largeint.pyx":133
|
|
2715 |
* item = (
|
|
2716 |
* (quad_items[ix + 3] << 192) +
|
|
2717 |
* (quad_items[ix + 2] << 128) + # <<<<<<<<<<<<<<
|
|
2718 |
* (quad_items[ix + 1] << 64) +
|
|
2719 |
* quad_items[ix]
|
|
2720 |
*/
|
|
2721 |
__pyx_t_1 = PyNumber_Add(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
|
|
2722 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2723 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
2724 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2725 |
|
|
2726 |
/* "clickhouse_driver/columns/largeint.pyx":135
|
|
2727 |
* (quad_items[ix + 2] << 128) +
|
|
2728 |
* (quad_items[ix + 1] << 64) +
|
|
2729 |
* quad_items[ix] # <<<<<<<<<<<<<<
|
|
2730 |
* )
|
|
2731 |
*
|
|
2732 |
*/
|
|
2733 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_v_ix, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 135, __pyx_L1_error)
|
|
2734 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2735 |
|
|
2736 |
/* "clickhouse_driver/columns/largeint.pyx":134
|
|
2737 |
* (quad_items[ix + 3] << 192) +
|
|
2738 |
* (quad_items[ix + 2] << 128) +
|
|
2739 |
* (quad_items[ix + 1] << 64) + # <<<<<<<<<<<<<<
|
|
2740 |
* quad_items[ix]
|
|
2741 |
* )
|
|
2742 |
*/
|
|
2743 |
__pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
2744 |
__Pyx_GOTREF(__pyx_t_8);
|
|
2745 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2746 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2747 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
|
|
2748 |
__pyx_t_8 = 0;
|
|
2749 |
}
|
|
2750 |
__pyx_L5:;
|
|
2751 |
|
|
2752 |
/* "clickhouse_driver/columns/largeint.pyx":138
|
|
2753 |
* )
|
|
2754 |
*
|
|
2755 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
2756 |
* PyTuple_SET_ITEM(items, i, item)
|
|
2757 |
*
|
|
2758 |
*/
|
|
2759 |
Py_INCREF(__pyx_v_item);
|
|
2760 |
|
|
2761 |
/* "clickhouse_driver/columns/largeint.pyx":139
|
|
2762 |
*
|
|
2763 |
* Py_INCREF(item)
|
|
2764 |
* PyTuple_SET_ITEM(items, i, item) # <<<<<<<<<<<<<<
|
|
2765 |
*
|
|
2766 |
* return items
|
|
2767 |
*/
|
|
2768 |
PyTuple_SET_ITEM(__pyx_v_items, __pyx_v_i, __pyx_v_item);
|
|
2769 |
}
|
|
2770 |
|
|
2771 |
/* "clickhouse_driver/columns/largeint.pyx":141
|
|
2772 |
* PyTuple_SET_ITEM(items, i, item)
|
|
2773 |
*
|
|
2774 |
* return items # <<<<<<<<<<<<<<
|
|
2775 |
*
|
|
2776 |
*
|
|
2777 |
*/
|
|
2778 |
__Pyx_XDECREF(__pyx_r);
|
|
2779 |
__Pyx_INCREF(__pyx_v_items);
|
|
2780 |
__pyx_r = __pyx_v_items;
|
|
2781 |
goto __pyx_L0;
|
|
2782 |
|
|
2783 |
/* "clickhouse_driver/columns/largeint.pyx":111
|
|
2784 |
*
|
|
2785 |
*
|
|
2786 |
* def int256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
2787 |
* cdef unsigned int factor = 4
|
|
2788 |
* items = PyTuple_New(n_items)
|
|
2789 |
*/
|
|
2790 |
|
|
2791 |
/* function exit code */
|
|
2792 |
__pyx_L1_error:;
|
|
2793 |
__Pyx_XDECREF(__pyx_t_1);
|
|
2794 |
__Pyx_XDECREF(__pyx_t_6);
|
|
2795 |
__Pyx_XDECREF(__pyx_t_8);
|
|
2796 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int256_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2797 |
__pyx_r = NULL;
|
|
2798 |
__pyx_L0:;
|
|
2799 |
__Pyx_XDECREF(__pyx_v_items);
|
|
2800 |
__Pyx_XDECREF(__pyx_v_item);
|
|
2801 |
__Pyx_XGIVEREF(__pyx_r);
|
|
2802 |
__Pyx_RefNannyFinishContext();
|
|
2803 |
return __pyx_r;
|
|
2804 |
}
|
|
2805 |
|
|
2806 |
/* "clickhouse_driver/columns/largeint.pyx":144
|
|
2807 |
*
|
|
2808 |
*
|
|
2809 |
* def int256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
2810 |
* cdef unsigned int factor = 4
|
|
2811 |
* quad_items = PyTuple_New(n_items * factor)
|
|
2812 |
*/
|
|
2813 |
|
|
2814 |
/* Python wrapper */
|
|
2815 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_11int256_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
2816 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_11int256_to_quads = {"int256_to_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_11int256_to_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
2817 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_11int256_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
2818 |
PyObject *__pyx_v_items = 0;
|
|
2819 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
2820 |
int __pyx_lineno = 0;
|
|
2821 |
const char *__pyx_filename = NULL;
|
|
2822 |
int __pyx_clineno = 0;
|
|
2823 |
PyObject *__pyx_r = 0;
|
|
2824 |
__Pyx_RefNannyDeclarations
|
|
2825 |
__Pyx_RefNannySetupContext("int256_to_quads (wrapper)", 0);
|
|
2826 |
{
|
|
2827 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,&__pyx_n_s_n_items,0};
|
|
2828 |
PyObject* values[2] = {0,0};
|
|
2829 |
if (unlikely(__pyx_kwds)) {
|
|
2830 |
Py_ssize_t kw_args;
|
|
2831 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
2832 |
switch (pos_args) {
|
|
2833 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
2834 |
CYTHON_FALLTHROUGH;
|
|
2835 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
2836 |
CYTHON_FALLTHROUGH;
|
|
2837 |
case 0: break;
|
|
2838 |
default: goto __pyx_L5_argtuple_error;
|
|
2839 |
}
|
|
2840 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
2841 |
switch (pos_args) {
|
|
2842 |
case 0:
|
|
2843 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items)) != 0)) kw_args--;
|
|
2844 |
else goto __pyx_L5_argtuple_error;
|
|
2845 |
CYTHON_FALLTHROUGH;
|
|
2846 |
case 1:
|
|
2847 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
2848 |
else {
|
|
2849 |
__Pyx_RaiseArgtupleInvalid("int256_to_quads", 1, 2, 2, 1); __PYX_ERR(0, 144, __pyx_L3_error)
|
|
2850 |
}
|
|
2851 |
}
|
|
2852 |
if (unlikely(kw_args > 0)) {
|
|
2853 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "int256_to_quads") < 0)) __PYX_ERR(0, 144, __pyx_L3_error)
|
|
2854 |
}
|
|
2855 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
2856 |
goto __pyx_L5_argtuple_error;
|
|
2857 |
} else {
|
|
2858 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
2859 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
2860 |
}
|
|
2861 |
__pyx_v_items = values[0];
|
|
2862 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L3_error)
|
|
2863 |
}
|
|
2864 |
goto __pyx_L4_argument_unpacking_done;
|
|
2865 |
__pyx_L5_argtuple_error:;
|
|
2866 |
__Pyx_RaiseArgtupleInvalid("int256_to_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 144, __pyx_L3_error)
|
|
2867 |
__pyx_L3_error:;
|
|
2868 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int256_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2869 |
__Pyx_RefNannyFinishContext();
|
|
2870 |
return NULL;
|
|
2871 |
__pyx_L4_argument_unpacking_done:;
|
|
2872 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_10int256_to_quads(__pyx_self, __pyx_v_items, __pyx_v_n_items);
|
|
2873 |
|
|
2874 |
/* function exit code */
|
|
2875 |
__Pyx_RefNannyFinishContext();
|
|
2876 |
return __pyx_r;
|
|
2877 |
}
|
|
2878 |
|
|
2879 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_10int256_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
2880 |
unsigned int __pyx_v_factor;
|
|
2881 |
PyObject *__pyx_v_quad_items = NULL;
|
|
2882 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
2883 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
2884 |
PyObject *__pyx_v_x = 0;
|
|
2885 |
PyObject *__pyx_v_item = 0;
|
|
2886 |
PyObject *__pyx_r = NULL;
|
|
2887 |
__Pyx_RefNannyDeclarations
|
|
2888 |
PyObject *__pyx_t_1 = NULL;
|
|
2889 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
2890 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
2891 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
2892 |
int __pyx_t_5;
|
|
2893 |
PyObject *__pyx_t_6 = NULL;
|
|
2894 |
int __pyx_lineno = 0;
|
|
2895 |
const char *__pyx_filename = NULL;
|
|
2896 |
int __pyx_clineno = 0;
|
|
2897 |
__Pyx_RefNannySetupContext("int256_to_quads", 0);
|
|
2898 |
|
|
2899 |
/* "clickhouse_driver/columns/largeint.pyx":145
|
|
2900 |
*
|
|
2901 |
* def int256_to_quads(items, unsigned long long n_items):
|
|
2902 |
* cdef unsigned int factor = 4 # <<<<<<<<<<<<<<
|
|
2903 |
* quad_items = PyTuple_New(n_items * factor)
|
|
2904 |
*
|
|
2905 |
*/
|
|
2906 |
__pyx_v_factor = 4;
|
|
2907 |
|
|
2908 |
/* "clickhouse_driver/columns/largeint.pyx":146
|
|
2909 |
* def int256_to_quads(items, unsigned long long n_items):
|
|
2910 |
* cdef unsigned int factor = 4
|
|
2911 |
* quad_items = PyTuple_New(n_items * factor) # <<<<<<<<<<<<<<
|
|
2912 |
*
|
|
2913 |
* cdef unsigned long long i, ix
|
|
2914 |
*/
|
|
2915 |
__pyx_t_1 = PyTuple_New((__pyx_v_n_items * __pyx_v_factor)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
|
|
2916 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2917 |
__pyx_v_quad_items = ((PyObject*)__pyx_t_1);
|
|
2918 |
__pyx_t_1 = 0;
|
|
2919 |
|
|
2920 |
/* "clickhouse_driver/columns/largeint.pyx":151
|
|
2921 |
* cdef object x, item
|
|
2922 |
*
|
|
2923 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
2924 |
* ix = factor * i
|
|
2925 |
*
|
|
2926 |
*/
|
|
2927 |
__pyx_t_2 = __pyx_v_n_items;
|
|
2928 |
__pyx_t_3 = __pyx_t_2;
|
|
2929 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
2930 |
__pyx_v_i = __pyx_t_4;
|
|
2931 |
|
|
2932 |
/* "clickhouse_driver/columns/largeint.pyx":152
|
|
2933 |
*
|
|
2934 |
* for i in range(n_items):
|
|
2935 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
2936 |
*
|
|
2937 |
* x = items[i]
|
|
2938 |
*/
|
|
2939 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
2940 |
|
|
2941 |
/* "clickhouse_driver/columns/largeint.pyx":154
|
|
2942 |
* ix = factor * i
|
|
2943 |
*
|
|
2944 |
* x = items[i] # <<<<<<<<<<<<<<
|
|
2945 |
* if x < 0:
|
|
2946 |
* x = -x - 1
|
|
2947 |
*/
|
|
2948 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_items, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
|
|
2949 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2950 |
__Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
|
|
2951 |
__pyx_t_1 = 0;
|
|
2952 |
|
|
2953 |
/* "clickhouse_driver/columns/largeint.pyx":155
|
|
2954 |
*
|
|
2955 |
* x = items[i]
|
|
2956 |
* if x < 0: # <<<<<<<<<<<<<<
|
|
2957 |
* x = -x - 1
|
|
2958 |
*
|
|
2959 |
*/
|
|
2960 |
__pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
|
|
2961 |
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 155, __pyx_L1_error)
|
|
2962 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2963 |
if (__pyx_t_5) {
|
|
2964 |
|
|
2965 |
/* "clickhouse_driver/columns/largeint.pyx":156
|
|
2966 |
* x = items[i]
|
|
2967 |
* if x < 0:
|
|
2968 |
* x = -x - 1 # <<<<<<<<<<<<<<
|
|
2969 |
*
|
|
2970 |
* item = MAX_UINT64 - x & MAX_UINT64
|
|
2971 |
*/
|
|
2972 |
__pyx_t_1 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
|
|
2973 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2974 |
__pyx_t_6 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error)
|
|
2975 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2976 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
2977 |
__Pyx_DECREF_SET(__pyx_v_x, __pyx_t_6);
|
|
2978 |
__pyx_t_6 = 0;
|
|
2979 |
|
|
2980 |
/* "clickhouse_driver/columns/largeint.pyx":158
|
|
2981 |
* x = -x - 1
|
|
2982 |
*
|
|
2983 |
* item = MAX_UINT64 - x & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
2984 |
* Py_INCREF(item)
|
|
2985 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
2986 |
*/
|
|
2987 |
__pyx_t_6 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_v_x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error)
|
|
2988 |
__Pyx_GOTREF(__pyx_t_6);
|
|
2989 |
__pyx_t_1 = PyNumber_And(__pyx_t_6, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
|
|
2990 |
__Pyx_GOTREF(__pyx_t_1);
|
|
2991 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
2992 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
2993 |
__pyx_t_1 = 0;
|
|
2994 |
|
|
2995 |
/* "clickhouse_driver/columns/largeint.pyx":159
|
|
2996 |
*
|
|
2997 |
* item = MAX_UINT64 - x & MAX_UINT64
|
|
2998 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
2999 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3000 |
*
|
|
3001 |
*/
|
|
3002 |
Py_INCREF(__pyx_v_item);
|
|
3003 |
|
|
3004 |
/* "clickhouse_driver/columns/largeint.pyx":160
|
|
3005 |
* item = MAX_UINT64 - x & MAX_UINT64
|
|
3006 |
* Py_INCREF(item)
|
|
3007 |
* PyTuple_SET_ITEM(quad_items, ix, item) # <<<<<<<<<<<<<<
|
|
3008 |
*
|
|
3009 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64
|
|
3010 |
*/
|
|
3011 |
PyTuple_SET_ITEM(__pyx_v_quad_items, __pyx_v_ix, __pyx_v_item);
|
|
3012 |
|
|
3013 |
/* "clickhouse_driver/columns/largeint.pyx":162
|
|
3014 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3015 |
*
|
|
3016 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3017 |
* Py_INCREF(item)
|
|
3018 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3019 |
*/
|
|
3020 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
|
|
3021 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3022 |
__pyx_t_6 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 162, __pyx_L1_error)
|
|
3023 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3024 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3025 |
__pyx_t_1 = PyNumber_And(__pyx_t_6, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
|
|
3026 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3027 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
3028 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3029 |
__pyx_t_1 = 0;
|
|
3030 |
|
|
3031 |
/* "clickhouse_driver/columns/largeint.pyx":163
|
|
3032 |
*
|
|
3033 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64
|
|
3034 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3035 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3036 |
*
|
|
3037 |
*/
|
|
3038 |
Py_INCREF(__pyx_v_item);
|
|
3039 |
|
|
3040 |
/* "clickhouse_driver/columns/largeint.pyx":164
|
|
3041 |
* item = MAX_UINT64 - (x >> 64) & MAX_UINT64
|
|
3042 |
* Py_INCREF(item)
|
|
3043 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item) # <<<<<<<<<<<<<<
|
|
3044 |
*
|
|
3045 |
* item = MAX_UINT64 - (x >> 128) & MAX_UINT64
|
|
3046 |
*/
|
|
3047 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 1), __pyx_v_item);
|
|
3048 |
|
|
3049 |
/* "clickhouse_driver/columns/largeint.pyx":166
|
|
3050 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3051 |
*
|
|
3052 |
* item = MAX_UINT64 - (x >> 128) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3053 |
* Py_INCREF(item)
|
|
3054 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3055 |
*/
|
|
3056 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_128); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
|
|
3057 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3058 |
__pyx_t_6 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L1_error)
|
|
3059 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3060 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3061 |
__pyx_t_1 = PyNumber_And(__pyx_t_6, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
|
|
3062 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3063 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
3064 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3065 |
__pyx_t_1 = 0;
|
|
3066 |
|
|
3067 |
/* "clickhouse_driver/columns/largeint.pyx":167
|
|
3068 |
*
|
|
3069 |
* item = MAX_UINT64 - (x >> 128) & MAX_UINT64
|
|
3070 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3071 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3072 |
*
|
|
3073 |
*/
|
|
3074 |
Py_INCREF(__pyx_v_item);
|
|
3075 |
|
|
3076 |
/* "clickhouse_driver/columns/largeint.pyx":168
|
|
3077 |
* item = MAX_UINT64 - (x >> 128) & MAX_UINT64
|
|
3078 |
* Py_INCREF(item)
|
|
3079 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item) # <<<<<<<<<<<<<<
|
|
3080 |
*
|
|
3081 |
* item = MAX_UINT64 - (x >> 192) & MAX_UINT64
|
|
3082 |
*/
|
|
3083 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 2), __pyx_v_item);
|
|
3084 |
|
|
3085 |
/* "clickhouse_driver/columns/largeint.pyx":170
|
|
3086 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3087 |
*
|
|
3088 |
* item = MAX_UINT64 - (x >> 192) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3089 |
* Py_INCREF(item)
|
|
3090 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3091 |
*/
|
|
3092 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_192); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
3093 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3094 |
__pyx_t_6 = PyNumber_Subtract(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
3095 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3096 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3097 |
__pyx_t_1 = PyNumber_And(__pyx_t_6, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
3098 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3099 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
3100 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3101 |
__pyx_t_1 = 0;
|
|
3102 |
|
|
3103 |
/* "clickhouse_driver/columns/largeint.pyx":171
|
|
3104 |
*
|
|
3105 |
* item = MAX_UINT64 - (x >> 192) & MAX_UINT64
|
|
3106 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3107 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3108 |
*
|
|
3109 |
*/
|
|
3110 |
Py_INCREF(__pyx_v_item);
|
|
3111 |
|
|
3112 |
/* "clickhouse_driver/columns/largeint.pyx":172
|
|
3113 |
* item = MAX_UINT64 - (x >> 192) & MAX_UINT64
|
|
3114 |
* Py_INCREF(item)
|
|
3115 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item) # <<<<<<<<<<<<<<
|
|
3116 |
*
|
|
3117 |
* else:
|
|
3118 |
*/
|
|
3119 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 3), __pyx_v_item);
|
|
3120 |
|
|
3121 |
/* "clickhouse_driver/columns/largeint.pyx":155
|
|
3122 |
*
|
|
3123 |
* x = items[i]
|
|
3124 |
* if x < 0: # <<<<<<<<<<<<<<
|
|
3125 |
* x = -x - 1
|
|
3126 |
*
|
|
3127 |
*/
|
|
3128 |
goto __pyx_L5;
|
|
3129 |
}
|
|
3130 |
|
|
3131 |
/* "clickhouse_driver/columns/largeint.pyx":175
|
|
3132 |
*
|
|
3133 |
* else:
|
|
3134 |
* item = x & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3135 |
* Py_INCREF(item)
|
|
3136 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3137 |
*/
|
|
3138 |
/*else*/ {
|
|
3139 |
__pyx_t_1 = PyNumber_And(__pyx_v_x, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
3140 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3141 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3142 |
__pyx_t_1 = 0;
|
|
3143 |
|
|
3144 |
/* "clickhouse_driver/columns/largeint.pyx":176
|
|
3145 |
* else:
|
|
3146 |
* item = x & MAX_UINT64
|
|
3147 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3148 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3149 |
*
|
|
3150 |
*/
|
|
3151 |
Py_INCREF(__pyx_v_item);
|
|
3152 |
|
|
3153 |
/* "clickhouse_driver/columns/largeint.pyx":177
|
|
3154 |
* item = x & MAX_UINT64
|
|
3155 |
* Py_INCREF(item)
|
|
3156 |
* PyTuple_SET_ITEM(quad_items, ix, item) # <<<<<<<<<<<<<<
|
|
3157 |
*
|
|
3158 |
* item = (x >> 64) & MAX_UINT64
|
|
3159 |
*/
|
|
3160 |
PyTuple_SET_ITEM(__pyx_v_quad_items, __pyx_v_ix, __pyx_v_item);
|
|
3161 |
|
|
3162 |
/* "clickhouse_driver/columns/largeint.pyx":179
|
|
3163 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3164 |
*
|
|
3165 |
* item = (x >> 64) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3166 |
* Py_INCREF(item)
|
|
3167 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3168 |
*/
|
|
3169 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
|
|
3170 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3171 |
__pyx_t_6 = PyNumber_And(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 179, __pyx_L1_error)
|
|
3172 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3173 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3174 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_6);
|
|
3175 |
__pyx_t_6 = 0;
|
|
3176 |
|
|
3177 |
/* "clickhouse_driver/columns/largeint.pyx":180
|
|
3178 |
*
|
|
3179 |
* item = (x >> 64) & MAX_UINT64
|
|
3180 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3181 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3182 |
*
|
|
3183 |
*/
|
|
3184 |
Py_INCREF(__pyx_v_item);
|
|
3185 |
|
|
3186 |
/* "clickhouse_driver/columns/largeint.pyx":181
|
|
3187 |
* item = (x >> 64) & MAX_UINT64
|
|
3188 |
* Py_INCREF(item)
|
|
3189 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item) # <<<<<<<<<<<<<<
|
|
3190 |
*
|
|
3191 |
* item = (x >> 128) & MAX_UINT64
|
|
3192 |
*/
|
|
3193 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 1), __pyx_v_item);
|
|
3194 |
|
|
3195 |
/* "clickhouse_driver/columns/largeint.pyx":183
|
|
3196 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3197 |
*
|
|
3198 |
* item = (x >> 128) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3199 |
* Py_INCREF(item)
|
|
3200 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3201 |
*/
|
|
3202 |
__pyx_t_6 = PyNumber_Rshift(__pyx_v_x, __pyx_int_128); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __pyx_L1_error)
|
|
3203 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3204 |
__pyx_t_1 = PyNumber_And(__pyx_t_6, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
|
|
3205 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3206 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
3207 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3208 |
__pyx_t_1 = 0;
|
|
3209 |
|
|
3210 |
/* "clickhouse_driver/columns/largeint.pyx":184
|
|
3211 |
*
|
|
3212 |
* item = (x >> 128) & MAX_UINT64
|
|
3213 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3214 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3215 |
*
|
|
3216 |
*/
|
|
3217 |
Py_INCREF(__pyx_v_item);
|
|
3218 |
|
|
3219 |
/* "clickhouse_driver/columns/largeint.pyx":185
|
|
3220 |
* item = (x >> 128) & MAX_UINT64
|
|
3221 |
* Py_INCREF(item)
|
|
3222 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item) # <<<<<<<<<<<<<<
|
|
3223 |
*
|
|
3224 |
* item = (x >> 192) & MAX_UINT64
|
|
3225 |
*/
|
|
3226 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 2), __pyx_v_item);
|
|
3227 |
|
|
3228 |
/* "clickhouse_driver/columns/largeint.pyx":187
|
|
3229 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3230 |
*
|
|
3231 |
* item = (x >> 192) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3232 |
* Py_INCREF(item)
|
|
3233 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3234 |
*/
|
|
3235 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_192); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error)
|
|
3236 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3237 |
__pyx_t_6 = PyNumber_And(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 187, __pyx_L1_error)
|
|
3238 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3239 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3240 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_6);
|
|
3241 |
__pyx_t_6 = 0;
|
|
3242 |
|
|
3243 |
/* "clickhouse_driver/columns/largeint.pyx":188
|
|
3244 |
*
|
|
3245 |
* item = (x >> 192) & MAX_UINT64
|
|
3246 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3247 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3248 |
*
|
|
3249 |
*/
|
|
3250 |
Py_INCREF(__pyx_v_item);
|
|
3251 |
|
|
3252 |
/* "clickhouse_driver/columns/largeint.pyx":189
|
|
3253 |
* item = (x >> 192) & MAX_UINT64
|
|
3254 |
* Py_INCREF(item)
|
|
3255 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item) # <<<<<<<<<<<<<<
|
|
3256 |
*
|
|
3257 |
* return quad_items
|
|
3258 |
*/
|
|
3259 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 3), __pyx_v_item);
|
|
3260 |
}
|
|
3261 |
__pyx_L5:;
|
|
3262 |
}
|
|
3263 |
|
|
3264 |
/* "clickhouse_driver/columns/largeint.pyx":191
|
|
3265 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3266 |
*
|
|
3267 |
* return quad_items # <<<<<<<<<<<<<<
|
|
3268 |
*
|
|
3269 |
*
|
|
3270 |
*/
|
|
3271 |
__Pyx_XDECREF(__pyx_r);
|
|
3272 |
__Pyx_INCREF(__pyx_v_quad_items);
|
|
3273 |
__pyx_r = __pyx_v_quad_items;
|
|
3274 |
goto __pyx_L0;
|
|
3275 |
|
|
3276 |
/* "clickhouse_driver/columns/largeint.pyx":144
|
|
3277 |
*
|
|
3278 |
*
|
|
3279 |
* def int256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
3280 |
* cdef unsigned int factor = 4
|
|
3281 |
* quad_items = PyTuple_New(n_items * factor)
|
|
3282 |
*/
|
|
3283 |
|
|
3284 |
/* function exit code */
|
|
3285 |
__pyx_L1_error:;
|
|
3286 |
__Pyx_XDECREF(__pyx_t_1);
|
|
3287 |
__Pyx_XDECREF(__pyx_t_6);
|
|
3288 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.int256_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3289 |
__pyx_r = NULL;
|
|
3290 |
__pyx_L0:;
|
|
3291 |
__Pyx_XDECREF(__pyx_v_quad_items);
|
|
3292 |
__Pyx_XDECREF(__pyx_v_x);
|
|
3293 |
__Pyx_XDECREF(__pyx_v_item);
|
|
3294 |
__Pyx_XGIVEREF(__pyx_r);
|
|
3295 |
__Pyx_RefNannyFinishContext();
|
|
3296 |
return __pyx_r;
|
|
3297 |
}
|
|
3298 |
|
|
3299 |
/* "clickhouse_driver/columns/largeint.pyx":194
|
|
3300 |
*
|
|
3301 |
*
|
|
3302 |
* def uint256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
3303 |
* cdef unsigned int factor = 4
|
|
3304 |
* items = PyTuple_New(n_items)
|
|
3305 |
*/
|
|
3306 |
|
|
3307 |
/* Python wrapper */
|
|
3308 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_13uint256_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
3309 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_13uint256_from_quads = {"uint256_from_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_13uint256_from_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
3310 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_13uint256_from_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
3311 |
PyObject *__pyx_v_quad_items = 0;
|
|
3312 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
3313 |
int __pyx_lineno = 0;
|
|
3314 |
const char *__pyx_filename = NULL;
|
|
3315 |
int __pyx_clineno = 0;
|
|
3316 |
PyObject *__pyx_r = 0;
|
|
3317 |
__Pyx_RefNannyDeclarations
|
|
3318 |
__Pyx_RefNannySetupContext("uint256_from_quads (wrapper)", 0);
|
|
3319 |
{
|
|
3320 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_quad_items,&__pyx_n_s_n_items,0};
|
|
3321 |
PyObject* values[2] = {0,0};
|
|
3322 |
if (unlikely(__pyx_kwds)) {
|
|
3323 |
Py_ssize_t kw_args;
|
|
3324 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
3325 |
switch (pos_args) {
|
|
3326 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
3327 |
CYTHON_FALLTHROUGH;
|
|
3328 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
3329 |
CYTHON_FALLTHROUGH;
|
|
3330 |
case 0: break;
|
|
3331 |
default: goto __pyx_L5_argtuple_error;
|
|
3332 |
}
|
|
3333 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
3334 |
switch (pos_args) {
|
|
3335 |
case 0:
|
|
3336 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quad_items)) != 0)) kw_args--;
|
|
3337 |
else goto __pyx_L5_argtuple_error;
|
|
3338 |
CYTHON_FALLTHROUGH;
|
|
3339 |
case 1:
|
|
3340 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
3341 |
else {
|
|
3342 |
__Pyx_RaiseArgtupleInvalid("uint256_from_quads", 1, 2, 2, 1); __PYX_ERR(0, 194, __pyx_L3_error)
|
|
3343 |
}
|
|
3344 |
}
|
|
3345 |
if (unlikely(kw_args > 0)) {
|
|
3346 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uint256_from_quads") < 0)) __PYX_ERR(0, 194, __pyx_L3_error)
|
|
3347 |
}
|
|
3348 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
3349 |
goto __pyx_L5_argtuple_error;
|
|
3350 |
} else {
|
|
3351 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
3352 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
3353 |
}
|
|
3354 |
__pyx_v_quad_items = values[0];
|
|
3355 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error)
|
|
3356 |
}
|
|
3357 |
goto __pyx_L4_argument_unpacking_done;
|
|
3358 |
__pyx_L5_argtuple_error:;
|
|
3359 |
__Pyx_RaiseArgtupleInvalid("uint256_from_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 194, __pyx_L3_error)
|
|
3360 |
__pyx_L3_error:;
|
|
3361 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint256_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3362 |
__Pyx_RefNannyFinishContext();
|
|
3363 |
return NULL;
|
|
3364 |
__pyx_L4_argument_unpacking_done:;
|
|
3365 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_12uint256_from_quads(__pyx_self, __pyx_v_quad_items, __pyx_v_n_items);
|
|
3366 |
|
|
3367 |
/* function exit code */
|
|
3368 |
__Pyx_RefNannyFinishContext();
|
|
3369 |
return __pyx_r;
|
|
3370 |
}
|
|
3371 |
|
|
3372 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_12uint256_from_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_quad_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
3373 |
unsigned int __pyx_v_factor;
|
|
3374 |
PyObject *__pyx_v_items = NULL;
|
|
3375 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
3376 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
3377 |
PyObject *__pyx_v_item = 0;
|
|
3378 |
PyObject *__pyx_r = NULL;
|
|
3379 |
__Pyx_RefNannyDeclarations
|
|
3380 |
PyObject *__pyx_t_1 = NULL;
|
|
3381 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
3382 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
3383 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
3384 |
unsigned PY_LONG_LONG __pyx_t_5;
|
|
3385 |
PyObject *__pyx_t_6 = NULL;
|
|
3386 |
PyObject *__pyx_t_7 = NULL;
|
|
3387 |
int __pyx_lineno = 0;
|
|
3388 |
const char *__pyx_filename = NULL;
|
|
3389 |
int __pyx_clineno = 0;
|
|
3390 |
__Pyx_RefNannySetupContext("uint256_from_quads", 0);
|
|
3391 |
|
|
3392 |
/* "clickhouse_driver/columns/largeint.pyx":195
|
|
3393 |
*
|
|
3394 |
* def uint256_from_quads(quad_items, unsigned long long n_items):
|
|
3395 |
* cdef unsigned int factor = 4 # <<<<<<<<<<<<<<
|
|
3396 |
* items = PyTuple_New(n_items)
|
|
3397 |
*
|
|
3398 |
*/
|
|
3399 |
__pyx_v_factor = 4;
|
|
3400 |
|
|
3401 |
/* "clickhouse_driver/columns/largeint.pyx":196
|
|
3402 |
* def uint256_from_quads(quad_items, unsigned long long n_items):
|
|
3403 |
* cdef unsigned int factor = 4
|
|
3404 |
* items = PyTuple_New(n_items) # <<<<<<<<<<<<<<
|
|
3405 |
*
|
|
3406 |
* cdef unsigned long long i, ix
|
|
3407 |
*/
|
|
3408 |
__pyx_t_1 = PyTuple_New(__pyx_v_n_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error)
|
|
3409 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3410 |
__pyx_v_items = ((PyObject*)__pyx_t_1);
|
|
3411 |
__pyx_t_1 = 0;
|
|
3412 |
|
|
3413 |
/* "clickhouse_driver/columns/largeint.pyx":201
|
|
3414 |
* cdef object item
|
|
3415 |
*
|
|
3416 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
3417 |
* ix = factor * i
|
|
3418 |
* item = (
|
|
3419 |
*/
|
|
3420 |
__pyx_t_2 = __pyx_v_n_items;
|
|
3421 |
__pyx_t_3 = __pyx_t_2;
|
|
3422 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
3423 |
__pyx_v_i = __pyx_t_4;
|
|
3424 |
|
|
3425 |
/* "clickhouse_driver/columns/largeint.pyx":202
|
|
3426 |
*
|
|
3427 |
* for i in range(n_items):
|
|
3428 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
3429 |
* item = (
|
|
3430 |
* (quad_items[ix + 3] << 192) +
|
|
3431 |
*/
|
|
3432 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
3433 |
|
|
3434 |
/* "clickhouse_driver/columns/largeint.pyx":204
|
|
3435 |
* ix = factor * i
|
|
3436 |
* item = (
|
|
3437 |
* (quad_items[ix + 3] << 192) + # <<<<<<<<<<<<<<
|
|
3438 |
* (quad_items[ix + 2] << 128) +
|
|
3439 |
* (quad_items[ix + 1] << 64) +
|
|
3440 |
*/
|
|
3441 |
__pyx_t_5 = (__pyx_v_ix + 3);
|
|
3442 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
|
|
3443 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3444 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_1, __pyx_int_192); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error)
|
|
3445 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3446 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3447 |
|
|
3448 |
/* "clickhouse_driver/columns/largeint.pyx":205
|
|
3449 |
* item = (
|
|
3450 |
* (quad_items[ix + 3] << 192) +
|
|
3451 |
* (quad_items[ix + 2] << 128) + # <<<<<<<<<<<<<<
|
|
3452 |
* (quad_items[ix + 1] << 64) +
|
|
3453 |
* quad_items[ix]
|
|
3454 |
*/
|
|
3455 |
__pyx_t_5 = (__pyx_v_ix + 2);
|
|
3456 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
|
|
3457 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3458 |
__pyx_t_7 = PyNumber_Lshift(__pyx_t_1, __pyx_int_128); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error)
|
|
3459 |
__Pyx_GOTREF(__pyx_t_7);
|
|
3460 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3461 |
|
|
3462 |
/* "clickhouse_driver/columns/largeint.pyx":204
|
|
3463 |
* ix = factor * i
|
|
3464 |
* item = (
|
|
3465 |
* (quad_items[ix + 3] << 192) + # <<<<<<<<<<<<<<
|
|
3466 |
* (quad_items[ix + 2] << 128) +
|
|
3467 |
* (quad_items[ix + 1] << 64) +
|
|
3468 |
*/
|
|
3469 |
__pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
|
|
3470 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3471 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
3472 |
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
3473 |
|
|
3474 |
/* "clickhouse_driver/columns/largeint.pyx":206
|
|
3475 |
* (quad_items[ix + 3] << 192) +
|
|
3476 |
* (quad_items[ix + 2] << 128) +
|
|
3477 |
* (quad_items[ix + 1] << 64) + # <<<<<<<<<<<<<<
|
|
3478 |
* quad_items[ix]
|
|
3479 |
* )
|
|
3480 |
*/
|
|
3481 |
__pyx_t_5 = (__pyx_v_ix + 1);
|
|
3482 |
__pyx_t_7 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_t_5, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 206, __pyx_L1_error)
|
|
3483 |
__Pyx_GOTREF(__pyx_t_7);
|
|
3484 |
__pyx_t_6 = PyNumber_Lshift(__pyx_t_7, __pyx_int_64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error)
|
|
3485 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3486 |
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
3487 |
|
|
3488 |
/* "clickhouse_driver/columns/largeint.pyx":205
|
|
3489 |
* item = (
|
|
3490 |
* (quad_items[ix + 3] << 192) +
|
|
3491 |
* (quad_items[ix + 2] << 128) + # <<<<<<<<<<<<<<
|
|
3492 |
* (quad_items[ix + 1] << 64) +
|
|
3493 |
* quad_items[ix]
|
|
3494 |
*/
|
|
3495 |
__pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error)
|
|
3496 |
__Pyx_GOTREF(__pyx_t_7);
|
|
3497 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3498 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
3499 |
|
|
3500 |
/* "clickhouse_driver/columns/largeint.pyx":207
|
|
3501 |
* (quad_items[ix + 2] << 128) +
|
|
3502 |
* (quad_items[ix + 1] << 64) +
|
|
3503 |
* quad_items[ix] # <<<<<<<<<<<<<<
|
|
3504 |
* )
|
|
3505 |
*
|
|
3506 |
*/
|
|
3507 |
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_quad_items, __pyx_v_ix, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error)
|
|
3508 |
__Pyx_GOTREF(__pyx_t_6);
|
|
3509 |
|
|
3510 |
/* "clickhouse_driver/columns/largeint.pyx":206
|
|
3511 |
* (quad_items[ix + 3] << 192) +
|
|
3512 |
* (quad_items[ix + 2] << 128) +
|
|
3513 |
* (quad_items[ix + 1] << 64) + # <<<<<<<<<<<<<<
|
|
3514 |
* quad_items[ix]
|
|
3515 |
* )
|
|
3516 |
*/
|
|
3517 |
__pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
|
|
3518 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3519 |
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
3520 |
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
3521 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3522 |
__pyx_t_1 = 0;
|
|
3523 |
|
|
3524 |
/* "clickhouse_driver/columns/largeint.pyx":210
|
|
3525 |
* )
|
|
3526 |
*
|
|
3527 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3528 |
* PyTuple_SET_ITEM(items, i, item)
|
|
3529 |
*
|
|
3530 |
*/
|
|
3531 |
Py_INCREF(__pyx_v_item);
|
|
3532 |
|
|
3533 |
/* "clickhouse_driver/columns/largeint.pyx":211
|
|
3534 |
*
|
|
3535 |
* Py_INCREF(item)
|
|
3536 |
* PyTuple_SET_ITEM(items, i, item) # <<<<<<<<<<<<<<
|
|
3537 |
*
|
|
3538 |
* return items
|
|
3539 |
*/
|
|
3540 |
PyTuple_SET_ITEM(__pyx_v_items, __pyx_v_i, __pyx_v_item);
|
|
3541 |
}
|
|
3542 |
|
|
3543 |
/* "clickhouse_driver/columns/largeint.pyx":213
|
|
3544 |
* PyTuple_SET_ITEM(items, i, item)
|
|
3545 |
*
|
|
3546 |
* return items # <<<<<<<<<<<<<<
|
|
3547 |
*
|
|
3548 |
*
|
|
3549 |
*/
|
|
3550 |
__Pyx_XDECREF(__pyx_r);
|
|
3551 |
__Pyx_INCREF(__pyx_v_items);
|
|
3552 |
__pyx_r = __pyx_v_items;
|
|
3553 |
goto __pyx_L0;
|
|
3554 |
|
|
3555 |
/* "clickhouse_driver/columns/largeint.pyx":194
|
|
3556 |
*
|
|
3557 |
*
|
|
3558 |
* def uint256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
3559 |
* cdef unsigned int factor = 4
|
|
3560 |
* items = PyTuple_New(n_items)
|
|
3561 |
*/
|
|
3562 |
|
|
3563 |
/* function exit code */
|
|
3564 |
__pyx_L1_error:;
|
|
3565 |
__Pyx_XDECREF(__pyx_t_1);
|
|
3566 |
__Pyx_XDECREF(__pyx_t_6);
|
|
3567 |
__Pyx_XDECREF(__pyx_t_7);
|
|
3568 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint256_from_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3569 |
__pyx_r = NULL;
|
|
3570 |
__pyx_L0:;
|
|
3571 |
__Pyx_XDECREF(__pyx_v_items);
|
|
3572 |
__Pyx_XDECREF(__pyx_v_item);
|
|
3573 |
__Pyx_XGIVEREF(__pyx_r);
|
|
3574 |
__Pyx_RefNannyFinishContext();
|
|
3575 |
return __pyx_r;
|
|
3576 |
}
|
|
3577 |
|
|
3578 |
/* "clickhouse_driver/columns/largeint.pyx":216
|
|
3579 |
*
|
|
3580 |
*
|
|
3581 |
* def uint256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
3582 |
* cdef unsigned int factor = 4
|
|
3583 |
* quad_items = PyTuple_New(n_items * factor)
|
|
3584 |
*/
|
|
3585 |
|
|
3586 |
/* Python wrapper */
|
|
3587 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_15uint256_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
3588 |
static PyMethodDef __pyx_mdef_17clickhouse_driver_7columns_8largeint_15uint256_to_quads = {"uint256_to_quads", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_17clickhouse_driver_7columns_8largeint_15uint256_to_quads, METH_VARARGS|METH_KEYWORDS, 0};
|
|
3589 |
static PyObject *__pyx_pw_17clickhouse_driver_7columns_8largeint_15uint256_to_quads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
3590 |
PyObject *__pyx_v_items = 0;
|
|
3591 |
unsigned PY_LONG_LONG __pyx_v_n_items;
|
|
3592 |
int __pyx_lineno = 0;
|
|
3593 |
const char *__pyx_filename = NULL;
|
|
3594 |
int __pyx_clineno = 0;
|
|
3595 |
PyObject *__pyx_r = 0;
|
|
3596 |
__Pyx_RefNannyDeclarations
|
|
3597 |
__Pyx_RefNannySetupContext("uint256_to_quads (wrapper)", 0);
|
|
3598 |
{
|
|
3599 |
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,&__pyx_n_s_n_items,0};
|
|
3600 |
PyObject* values[2] = {0,0};
|
|
3601 |
if (unlikely(__pyx_kwds)) {
|
|
3602 |
Py_ssize_t kw_args;
|
|
3603 |
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
|
|
3604 |
switch (pos_args) {
|
|
3605 |
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
3606 |
CYTHON_FALLTHROUGH;
|
|
3607 |
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
3608 |
CYTHON_FALLTHROUGH;
|
|
3609 |
case 0: break;
|
|
3610 |
default: goto __pyx_L5_argtuple_error;
|
|
3611 |
}
|
|
3612 |
kw_args = PyDict_Size(__pyx_kwds);
|
|
3613 |
switch (pos_args) {
|
|
3614 |
case 0:
|
|
3615 |
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items)) != 0)) kw_args--;
|
|
3616 |
else goto __pyx_L5_argtuple_error;
|
|
3617 |
CYTHON_FALLTHROUGH;
|
|
3618 |
case 1:
|
|
3619 |
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n_items)) != 0)) kw_args--;
|
|
3620 |
else {
|
|
3621 |
__Pyx_RaiseArgtupleInvalid("uint256_to_quads", 1, 2, 2, 1); __PYX_ERR(0, 216, __pyx_L3_error)
|
|
3622 |
}
|
|
3623 |
}
|
|
3624 |
if (unlikely(kw_args > 0)) {
|
|
3625 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "uint256_to_quads") < 0)) __PYX_ERR(0, 216, __pyx_L3_error)
|
|
3626 |
}
|
|
3627 |
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
|
|
3628 |
goto __pyx_L5_argtuple_error;
|
|
3629 |
} else {
|
|
3630 |
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
|
|
3631 |
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
|
|
3632 |
}
|
|
3633 |
__pyx_v_items = values[0];
|
|
3634 |
__pyx_v_n_items = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(values[1]); if (unlikely((__pyx_v_n_items == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error)
|
|
3635 |
}
|
|
3636 |
goto __pyx_L4_argument_unpacking_done;
|
|
3637 |
__pyx_L5_argtuple_error:;
|
|
3638 |
__Pyx_RaiseArgtupleInvalid("uint256_to_quads", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error)
|
|
3639 |
__pyx_L3_error:;
|
|
3640 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint256_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3641 |
__Pyx_RefNannyFinishContext();
|
|
3642 |
return NULL;
|
|
3643 |
__pyx_L4_argument_unpacking_done:;
|
|
3644 |
__pyx_r = __pyx_pf_17clickhouse_driver_7columns_8largeint_14uint256_to_quads(__pyx_self, __pyx_v_items, __pyx_v_n_items);
|
|
3645 |
|
|
3646 |
/* function exit code */
|
|
3647 |
__Pyx_RefNannyFinishContext();
|
|
3648 |
return __pyx_r;
|
|
3649 |
}
|
|
3650 |
|
|
3651 |
static PyObject *__pyx_pf_17clickhouse_driver_7columns_8largeint_14uint256_to_quads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_items, unsigned PY_LONG_LONG __pyx_v_n_items) {
|
|
3652 |
unsigned int __pyx_v_factor;
|
|
3653 |
PyObject *__pyx_v_quad_items = NULL;
|
|
3654 |
unsigned PY_LONG_LONG __pyx_v_i;
|
|
3655 |
unsigned PY_LONG_LONG __pyx_v_ix;
|
|
3656 |
PyObject *__pyx_v_x = 0;
|
|
3657 |
PyObject *__pyx_v_item = 0;
|
|
3658 |
PyObject *__pyx_r = NULL;
|
|
3659 |
__Pyx_RefNannyDeclarations
|
|
3660 |
PyObject *__pyx_t_1 = NULL;
|
|
3661 |
unsigned PY_LONG_LONG __pyx_t_2;
|
|
3662 |
unsigned PY_LONG_LONG __pyx_t_3;
|
|
3663 |
unsigned PY_LONG_LONG __pyx_t_4;
|
|
3664 |
PyObject *__pyx_t_5 = NULL;
|
|
3665 |
int __pyx_lineno = 0;
|
|
3666 |
const char *__pyx_filename = NULL;
|
|
3667 |
int __pyx_clineno = 0;
|
|
3668 |
__Pyx_RefNannySetupContext("uint256_to_quads", 0);
|
|
3669 |
|
|
3670 |
/* "clickhouse_driver/columns/largeint.pyx":217
|
|
3671 |
*
|
|
3672 |
* def uint256_to_quads(items, unsigned long long n_items):
|
|
3673 |
* cdef unsigned int factor = 4 # <<<<<<<<<<<<<<
|
|
3674 |
* quad_items = PyTuple_New(n_items * factor)
|
|
3675 |
*
|
|
3676 |
*/
|
|
3677 |
__pyx_v_factor = 4;
|
|
3678 |
|
|
3679 |
/* "clickhouse_driver/columns/largeint.pyx":218
|
|
3680 |
* def uint256_to_quads(items, unsigned long long n_items):
|
|
3681 |
* cdef unsigned int factor = 4
|
|
3682 |
* quad_items = PyTuple_New(n_items * factor) # <<<<<<<<<<<<<<
|
|
3683 |
*
|
|
3684 |
* cdef unsigned long long i, ix
|
|
3685 |
*/
|
|
3686 |
__pyx_t_1 = PyTuple_New((__pyx_v_n_items * __pyx_v_factor)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
|
|
3687 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3688 |
__pyx_v_quad_items = ((PyObject*)__pyx_t_1);
|
|
3689 |
__pyx_t_1 = 0;
|
|
3690 |
|
|
3691 |
/* "clickhouse_driver/columns/largeint.pyx":223
|
|
3692 |
* cdef object x, item
|
|
3693 |
*
|
|
3694 |
* for i in range(n_items): # <<<<<<<<<<<<<<
|
|
3695 |
* ix = factor * i
|
|
3696 |
*
|
|
3697 |
*/
|
|
3698 |
__pyx_t_2 = __pyx_v_n_items;
|
|
3699 |
__pyx_t_3 = __pyx_t_2;
|
|
3700 |
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
|
|
3701 |
__pyx_v_i = __pyx_t_4;
|
|
3702 |
|
|
3703 |
/* "clickhouse_driver/columns/largeint.pyx":224
|
|
3704 |
*
|
|
3705 |
* for i in range(n_items):
|
|
3706 |
* ix = factor * i # <<<<<<<<<<<<<<
|
|
3707 |
*
|
|
3708 |
* x = items[i]
|
|
3709 |
*/
|
|
3710 |
__pyx_v_ix = (__pyx_v_factor * __pyx_v_i);
|
|
3711 |
|
|
3712 |
/* "clickhouse_driver/columns/largeint.pyx":226
|
|
3713 |
* ix = factor * i
|
|
3714 |
*
|
|
3715 |
* x = items[i] # <<<<<<<<<<<<<<
|
|
3716 |
* item = x & MAX_UINT64
|
|
3717 |
* Py_INCREF(item)
|
|
3718 |
*/
|
|
3719 |
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_items, __pyx_v_i, unsigned PY_LONG_LONG, 0, __Pyx_PyInt_From_unsigned_PY_LONG_LONG, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error)
|
|
3720 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3721 |
__Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
|
|
3722 |
__pyx_t_1 = 0;
|
|
3723 |
|
|
3724 |
/* "clickhouse_driver/columns/largeint.pyx":227
|
|
3725 |
*
|
|
3726 |
* x = items[i]
|
|
3727 |
* item = x & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3728 |
* Py_INCREF(item)
|
|
3729 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3730 |
*/
|
|
3731 |
__pyx_t_1 = PyNumber_And(__pyx_v_x, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
|
|
3732 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3733 |
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3734 |
__pyx_t_1 = 0;
|
|
3735 |
|
|
3736 |
/* "clickhouse_driver/columns/largeint.pyx":228
|
|
3737 |
* x = items[i]
|
|
3738 |
* item = x & MAX_UINT64
|
|
3739 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3740 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3741 |
*
|
|
3742 |
*/
|
|
3743 |
Py_INCREF(__pyx_v_item);
|
|
3744 |
|
|
3745 |
/* "clickhouse_driver/columns/largeint.pyx":229
|
|
3746 |
* item = x & MAX_UINT64
|
|
3747 |
* Py_INCREF(item)
|
|
3748 |
* PyTuple_SET_ITEM(quad_items, ix, item) # <<<<<<<<<<<<<<
|
|
3749 |
*
|
|
3750 |
* item = (x >> 64) & MAX_UINT64
|
|
3751 |
*/
|
|
3752 |
PyTuple_SET_ITEM(__pyx_v_quad_items, __pyx_v_ix, __pyx_v_item);
|
|
3753 |
|
|
3754 |
/* "clickhouse_driver/columns/largeint.pyx":231
|
|
3755 |
* PyTuple_SET_ITEM(quad_items, ix, item)
|
|
3756 |
*
|
|
3757 |
* item = (x >> 64) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3758 |
* Py_INCREF(item)
|
|
3759 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3760 |
*/
|
|
3761 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
|
|
3762 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3763 |
__pyx_t_5 = PyNumber_And(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L1_error)
|
|
3764 |
__Pyx_GOTREF(__pyx_t_5);
|
|
3765 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3766 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_5);
|
|
3767 |
__pyx_t_5 = 0;
|
|
3768 |
|
|
3769 |
/* "clickhouse_driver/columns/largeint.pyx":232
|
|
3770 |
*
|
|
3771 |
* item = (x >> 64) & MAX_UINT64
|
|
3772 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3773 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3774 |
*
|
|
3775 |
*/
|
|
3776 |
Py_INCREF(__pyx_v_item);
|
|
3777 |
|
|
3778 |
/* "clickhouse_driver/columns/largeint.pyx":233
|
|
3779 |
* item = (x >> 64) & MAX_UINT64
|
|
3780 |
* Py_INCREF(item)
|
|
3781 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item) # <<<<<<<<<<<<<<
|
|
3782 |
*
|
|
3783 |
* item = (x >> 128) & MAX_UINT64
|
|
3784 |
*/
|
|
3785 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 1), __pyx_v_item);
|
|
3786 |
|
|
3787 |
/* "clickhouse_driver/columns/largeint.pyx":235
|
|
3788 |
* PyTuple_SET_ITEM(quad_items, ix + 1, item)
|
|
3789 |
*
|
|
3790 |
* item = (x >> 128) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3791 |
* Py_INCREF(item)
|
|
3792 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3793 |
*/
|
|
3794 |
__pyx_t_5 = PyNumber_Rshift(__pyx_v_x, __pyx_int_128); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
3795 |
__Pyx_GOTREF(__pyx_t_5);
|
|
3796 |
__pyx_t_1 = PyNumber_And(__pyx_t_5, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
3797 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3798 |
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
|
3799 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1);
|
|
3800 |
__pyx_t_1 = 0;
|
|
3801 |
|
|
3802 |
/* "clickhouse_driver/columns/largeint.pyx":236
|
|
3803 |
*
|
|
3804 |
* item = (x >> 128) & MAX_UINT64
|
|
3805 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3806 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3807 |
*
|
|
3808 |
*/
|
|
3809 |
Py_INCREF(__pyx_v_item);
|
|
3810 |
|
|
3811 |
/* "clickhouse_driver/columns/largeint.pyx":237
|
|
3812 |
* item = (x >> 128) & MAX_UINT64
|
|
3813 |
* Py_INCREF(item)
|
|
3814 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item) # <<<<<<<<<<<<<<
|
|
3815 |
*
|
|
3816 |
* item = (x >> 192) & MAX_UINT64
|
|
3817 |
*/
|
|
3818 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 2), __pyx_v_item);
|
|
3819 |
|
|
3820 |
/* "clickhouse_driver/columns/largeint.pyx":239
|
|
3821 |
* PyTuple_SET_ITEM(quad_items, ix + 2, item)
|
|
3822 |
*
|
|
3823 |
* item = (x >> 192) & MAX_UINT64 # <<<<<<<<<<<<<<
|
|
3824 |
* Py_INCREF(item)
|
|
3825 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3826 |
*/
|
|
3827 |
__pyx_t_1 = PyNumber_Rshift(__pyx_v_x, __pyx_int_192); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
|
|
3828 |
__Pyx_GOTREF(__pyx_t_1);
|
|
3829 |
__pyx_t_5 = PyNumber_And(__pyx_t_1, __pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error)
|
|
3830 |
__Pyx_GOTREF(__pyx_t_5);
|
|
3831 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
3832 |
__Pyx_DECREF_SET(__pyx_v_item, __pyx_t_5);
|
|
3833 |
__pyx_t_5 = 0;
|
|
3834 |
|
|
3835 |
/* "clickhouse_driver/columns/largeint.pyx":240
|
|
3836 |
*
|
|
3837 |
* item = (x >> 192) & MAX_UINT64
|
|
3838 |
* Py_INCREF(item) # <<<<<<<<<<<<<<
|
|
3839 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3840 |
*
|
|
3841 |
*/
|
|
3842 |
Py_INCREF(__pyx_v_item);
|
|
3843 |
|
|
3844 |
/* "clickhouse_driver/columns/largeint.pyx":241
|
|
3845 |
* item = (x >> 192) & MAX_UINT64
|
|
3846 |
* Py_INCREF(item)
|
|
3847 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item) # <<<<<<<<<<<<<<
|
|
3848 |
*
|
|
3849 |
* return quad_items
|
|
3850 |
*/
|
|
3851 |
PyTuple_SET_ITEM(__pyx_v_quad_items, (__pyx_v_ix + 3), __pyx_v_item);
|
|
3852 |
}
|
|
3853 |
|
|
3854 |
/* "clickhouse_driver/columns/largeint.pyx":243
|
|
3855 |
* PyTuple_SET_ITEM(quad_items, ix + 3, item)
|
|
3856 |
*
|
|
3857 |
* return quad_items # <<<<<<<<<<<<<<
|
|
3858 |
*/
|
|
3859 |
__Pyx_XDECREF(__pyx_r);
|
|
3860 |
__Pyx_INCREF(__pyx_v_quad_items);
|
|
3861 |
__pyx_r = __pyx_v_quad_items;
|
|
3862 |
goto __pyx_L0;
|
|
3863 |
|
|
3864 |
/* "clickhouse_driver/columns/largeint.pyx":216
|
|
3865 |
*
|
|
3866 |
*
|
|
3867 |
* def uint256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
3868 |
* cdef unsigned int factor = 4
|
|
3869 |
* quad_items = PyTuple_New(n_items * factor)
|
|
3870 |
*/
|
|
3871 |
|
|
3872 |
/* function exit code */
|
|
3873 |
__pyx_L1_error:;
|
|
3874 |
__Pyx_XDECREF(__pyx_t_1);
|
|
3875 |
__Pyx_XDECREF(__pyx_t_5);
|
|
3876 |
__Pyx_AddTraceback("clickhouse_driver.columns.largeint.uint256_to_quads", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3877 |
__pyx_r = NULL;
|
|
3878 |
__pyx_L0:;
|
|
3879 |
__Pyx_XDECREF(__pyx_v_quad_items);
|
|
3880 |
__Pyx_XDECREF(__pyx_v_x);
|
|
3881 |
__Pyx_XDECREF(__pyx_v_item);
|
|
3882 |
__Pyx_XGIVEREF(__pyx_r);
|
|
3883 |
__Pyx_RefNannyFinishContext();
|
|
3884 |
return __pyx_r;
|
|
3885 |
}
|
|
3886 |
|
|
3887 |
static PyMethodDef __pyx_methods[] = {
|
|
3888 |
{0, 0, 0, 0}
|
|
3889 |
};
|
|
3890 |
|
|
3891 |
#if PY_MAJOR_VERSION >= 3
|
|
3892 |
#if CYTHON_PEP489_MULTI_PHASE_INIT
|
|
3893 |
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
|
|
3894 |
static int __pyx_pymod_exec_largeint(PyObject* module); /*proto*/
|
|
3895 |
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
|
|
3896 |
{Py_mod_create, (void*)__pyx_pymod_create},
|
|
3897 |
{Py_mod_exec, (void*)__pyx_pymod_exec_largeint},
|
|
3898 |
{0, NULL}
|
|
3899 |
};
|
|
3900 |
#endif
|
|
3901 |
|
|
3902 |
static struct PyModuleDef __pyx_moduledef = {
|
|
3903 |
PyModuleDef_HEAD_INIT,
|
|
3904 |
"largeint",
|
|
3905 |
0, /* m_doc */
|
|
3906 |
#if CYTHON_PEP489_MULTI_PHASE_INIT
|
|
3907 |
0, /* m_size */
|
|
3908 |
#else
|
|
3909 |
-1, /* m_size */
|
|
3910 |
#endif
|
|
3911 |
__pyx_methods /* m_methods */,
|
|
3912 |
#if CYTHON_PEP489_MULTI_PHASE_INIT
|
|
3913 |
__pyx_moduledef_slots, /* m_slots */
|
|
3914 |
#else
|
|
3915 |
NULL, /* m_reload */
|
|
3916 |
#endif
|
|
3917 |
NULL, /* m_traverse */
|
|
3918 |
NULL, /* m_clear */
|
|
3919 |
NULL /* m_free */
|
|
3920 |
};
|
|
3921 |
#endif
|
|
3922 |
#ifndef CYTHON_SMALL_CODE
|
|
3923 |
#if defined(__clang__)
|
|
3924 |
#define CYTHON_SMALL_CODE
|
|
3925 |
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
|
3926 |
#define CYTHON_SMALL_CODE __attribute__((cold))
|
|
3927 |
#else
|
|
3928 |
#define CYTHON_SMALL_CODE
|
|
3929 |
#endif
|
|
3930 |
#endif
|
|
3931 |
|
|
3932 |
static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
|
3933 |
{&__pyx_n_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 1},
|
|
3934 |
{&__pyx_n_s_MAX_INT64, __pyx_k_MAX_INT64, sizeof(__pyx_k_MAX_INT64), 0, 0, 1, 1},
|
|
3935 |
{&__pyx_n_s_MAX_UINT64, __pyx_k_MAX_UINT64, sizeof(__pyx_k_MAX_UINT64), 0, 0, 1, 1},
|
|
3936 |
{&__pyx_kp_s_clickhouse_driver_columns_largei, __pyx_k_clickhouse_driver_columns_largei, sizeof(__pyx_k_clickhouse_driver_columns_largei), 0, 0, 1, 0},
|
|
3937 |
{&__pyx_n_s_clickhouse_driver_columns_largei_2, __pyx_k_clickhouse_driver_columns_largei_2, sizeof(__pyx_k_clickhouse_driver_columns_largei_2), 0, 0, 1, 1},
|
|
3938 |
{&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
|
|
3939 |
{&__pyx_n_s_factor, __pyx_k_factor, sizeof(__pyx_k_factor), 0, 0, 1, 1},
|
|
3940 |
{&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
|
|
3941 |
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
|
|
3942 |
{&__pyx_n_s_int128_from_quads, __pyx_k_int128_from_quads, sizeof(__pyx_k_int128_from_quads), 0, 0, 1, 1},
|
|
3943 |
{&__pyx_n_s_int128_to_quads, __pyx_k_int128_to_quads, sizeof(__pyx_k_int128_to_quads), 0, 0, 1, 1},
|
|
3944 |
{&__pyx_n_s_int256_from_quads, __pyx_k_int256_from_quads, sizeof(__pyx_k_int256_from_quads), 0, 0, 1, 1},
|
|
3945 |
{&__pyx_n_s_int256_to_quads, __pyx_k_int256_to_quads, sizeof(__pyx_k_int256_to_quads), 0, 0, 1, 1},
|
|
3946 |
{&__pyx_n_s_item, __pyx_k_item, sizeof(__pyx_k_item), 0, 0, 1, 1},
|
|
3947 |
{&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
|
|
3948 |
{&__pyx_n_s_ix, __pyx_k_ix, sizeof(__pyx_k_ix), 0, 0, 1, 1},
|
|
3949 |
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
|
|
3950 |
{&__pyx_n_s_n_items, __pyx_k_n_items, sizeof(__pyx_k_n_items), 0, 0, 1, 1},
|
|
3951 |
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
|
|
3952 |
{&__pyx_n_s_quad_items, __pyx_k_quad_items, sizeof(__pyx_k_quad_items), 0, 0, 1, 1},
|
|
3953 |
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
|
|
3954 |
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
|
|
3955 |
{&__pyx_n_s_uint128_from_quads, __pyx_k_uint128_from_quads, sizeof(__pyx_k_uint128_from_quads), 0, 0, 1, 1},
|
|
3956 |
{&__pyx_n_s_uint128_to_quads, __pyx_k_uint128_to_quads, sizeof(__pyx_k_uint128_to_quads), 0, 0, 1, 1},
|
|
3957 |
{&__pyx_n_s_uint256_from_quads, __pyx_k_uint256_from_quads, sizeof(__pyx_k_uint256_from_quads), 0, 0, 1, 1},
|
|
3958 |
{&__pyx_n_s_uint256_to_quads, __pyx_k_uint256_to_quads, sizeof(__pyx_k_uint256_to_quads), 0, 0, 1, 1},
|
|
3959 |
{&__pyx_n_s_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 0, 0, 1, 1},
|
|
3960 |
{&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
|
|
3961 |
{0, 0, 0, 0, 0, 0, 0}
|
|
3962 |
};
|
|
3963 |
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
|
|
3964 |
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 17, __pyx_L1_error)
|
|
3965 |
return 0;
|
|
3966 |
__pyx_L1_error:;
|
|
3967 |
return -1;
|
|
3968 |
}
|
|
3969 |
|
|
3970 |
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
|
|
3971 |
__Pyx_RefNannyDeclarations
|
|
3972 |
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
|
|
3973 |
|
|
3974 |
/* "clickhouse_driver/columns/largeint.pyx":10
|
|
3975 |
*
|
|
3976 |
*
|
|
3977 |
* def int128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
3978 |
* cdef unsigned int factor = 2
|
|
3979 |
* items = PyTuple_New(n_items)
|
|
3980 |
*/
|
|
3981 |
__pyx_tuple__2 = PyTuple_Pack(7, __pyx_n_s_quad_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_item); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 10, __pyx_L1_error)
|
|
3982 |
__Pyx_GOTREF(__pyx_tuple__2);
|
|
3983 |
__Pyx_GIVEREF(__pyx_tuple__2);
|
|
3984 |
__pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_int128_from_quads, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 10, __pyx_L1_error)
|
|
3985 |
|
|
3986 |
/* "clickhouse_driver/columns/largeint.pyx":36
|
|
3987 |
*
|
|
3988 |
*
|
|
3989 |
* def int128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
3990 |
* cdef unsigned int factor = 2
|
|
3991 |
* quad_items = PyTuple_New(n_items * factor)
|
|
3992 |
*/
|
|
3993 |
__pyx_tuple__4 = PyTuple_Pack(8, __pyx_n_s_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_quad_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_x, __pyx_n_s_item); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 36, __pyx_L1_error)
|
|
3994 |
__Pyx_GOTREF(__pyx_tuple__4);
|
|
3995 |
__Pyx_GIVEREF(__pyx_tuple__4);
|
|
3996 |
__pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_int128_to_quads, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 36, __pyx_L1_error)
|
|
3997 |
|
|
3998 |
/* "clickhouse_driver/columns/largeint.pyx":70
|
|
3999 |
*
|
|
4000 |
*
|
|
4001 |
* def uint128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4002 |
* cdef unsigned int factor = 2
|
|
4003 |
* items = PyTuple_New(n_items)
|
|
4004 |
*/
|
|
4005 |
__pyx_tuple__6 = PyTuple_Pack(7, __pyx_n_s_quad_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_item); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 70, __pyx_L1_error)
|
|
4006 |
__Pyx_GOTREF(__pyx_tuple__6);
|
|
4007 |
__Pyx_GIVEREF(__pyx_tuple__6);
|
|
4008 |
__pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_uint128_from_quads, 70, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 70, __pyx_L1_error)
|
|
4009 |
|
|
4010 |
/* "clickhouse_driver/columns/largeint.pyx":87
|
|
4011 |
*
|
|
4012 |
*
|
|
4013 |
* def uint128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4014 |
* cdef unsigned int factor = 2
|
|
4015 |
* quad_items = PyTuple_New(n_items * factor)
|
|
4016 |
*/
|
|
4017 |
__pyx_tuple__8 = PyTuple_Pack(8, __pyx_n_s_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_quad_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_x, __pyx_n_s_item); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 87, __pyx_L1_error)
|
|
4018 |
__Pyx_GOTREF(__pyx_tuple__8);
|
|
4019 |
__Pyx_GIVEREF(__pyx_tuple__8);
|
|
4020 |
__pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_uint128_to_quads, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 87, __pyx_L1_error)
|
|
4021 |
|
|
4022 |
/* "clickhouse_driver/columns/largeint.pyx":111
|
|
4023 |
*
|
|
4024 |
*
|
|
4025 |
* def int256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4026 |
* cdef unsigned int factor = 4
|
|
4027 |
* items = PyTuple_New(n_items)
|
|
4028 |
*/
|
|
4029 |
__pyx_tuple__10 = PyTuple_Pack(7, __pyx_n_s_quad_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_item); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 111, __pyx_L1_error)
|
|
4030 |
__Pyx_GOTREF(__pyx_tuple__10);
|
|
4031 |
__Pyx_GIVEREF(__pyx_tuple__10);
|
|
4032 |
__pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_int256_from_quads, 111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 111, __pyx_L1_error)
|
|
4033 |
|
|
4034 |
/* "clickhouse_driver/columns/largeint.pyx":144
|
|
4035 |
*
|
|
4036 |
*
|
|
4037 |
* def int256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4038 |
* cdef unsigned int factor = 4
|
|
4039 |
* quad_items = PyTuple_New(n_items * factor)
|
|
4040 |
*/
|
|
4041 |
__pyx_tuple__12 = PyTuple_Pack(8, __pyx_n_s_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_quad_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_x, __pyx_n_s_item); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
4042 |
__Pyx_GOTREF(__pyx_tuple__12);
|
|
4043 |
__Pyx_GIVEREF(__pyx_tuple__12);
|
|
4044 |
__pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_int256_to_quads, 144, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
4045 |
|
|
4046 |
/* "clickhouse_driver/columns/largeint.pyx":194
|
|
4047 |
*
|
|
4048 |
*
|
|
4049 |
* def uint256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4050 |
* cdef unsigned int factor = 4
|
|
4051 |
* items = PyTuple_New(n_items)
|
|
4052 |
*/
|
|
4053 |
__pyx_tuple__14 = PyTuple_Pack(7, __pyx_n_s_quad_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_item); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 194, __pyx_L1_error)
|
|
4054 |
__Pyx_GOTREF(__pyx_tuple__14);
|
|
4055 |
__Pyx_GIVEREF(__pyx_tuple__14);
|
|
4056 |
__pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_uint256_from_quads, 194, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 194, __pyx_L1_error)
|
|
4057 |
|
|
4058 |
/* "clickhouse_driver/columns/largeint.pyx":216
|
|
4059 |
*
|
|
4060 |
*
|
|
4061 |
* def uint256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4062 |
* cdef unsigned int factor = 4
|
|
4063 |
* quad_items = PyTuple_New(n_items * factor)
|
|
4064 |
*/
|
|
4065 |
__pyx_tuple__16 = PyTuple_Pack(8, __pyx_n_s_items, __pyx_n_s_n_items, __pyx_n_s_factor, __pyx_n_s_quad_items, __pyx_n_s_i, __pyx_n_s_ix, __pyx_n_s_x, __pyx_n_s_item); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 216, __pyx_L1_error)
|
|
4066 |
__Pyx_GOTREF(__pyx_tuple__16);
|
|
4067 |
__Pyx_GIVEREF(__pyx_tuple__16);
|
|
4068 |
__pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_columns_largei, __pyx_n_s_uint256_to_quads, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 216, __pyx_L1_error)
|
|
4069 |
__Pyx_RefNannyFinishContext();
|
|
4070 |
return 0;
|
|
4071 |
__pyx_L1_error:;
|
|
4072 |
__Pyx_RefNannyFinishContext();
|
|
4073 |
return -1;
|
|
4074 |
}
|
|
4075 |
|
|
4076 |
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
|
|
4077 |
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
|
|
4078 |
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4079 |
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4080 |
__pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4081 |
__pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4082 |
__pyx_int_192 = PyInt_FromLong(192); if (unlikely(!__pyx_int_192)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4083 |
return 0;
|
|
4084 |
__pyx_L1_error:;
|
|
4085 |
return -1;
|
|
4086 |
}
|
|
4087 |
|
|
4088 |
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
|
|
4089 |
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
|
|
4090 |
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
|
|
4091 |
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
|
|
4092 |
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
|
|
4093 |
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
|
|
4094 |
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
|
|
4095 |
|
|
4096 |
static int __Pyx_modinit_global_init_code(void) {
|
|
4097 |
__Pyx_RefNannyDeclarations
|
|
4098 |
__Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
|
|
4099 |
/*--- Global init code ---*/
|
|
4100 |
__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64 = Py_None; Py_INCREF(Py_None);
|
|
4101 |
__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_INT64 = Py_None; Py_INCREF(Py_None);
|
|
4102 |
__Pyx_RefNannyFinishContext();
|
|
4103 |
return 0;
|
|
4104 |
}
|
|
4105 |
|
|
4106 |
static int __Pyx_modinit_variable_export_code(void) {
|
|
4107 |
__Pyx_RefNannyDeclarations
|
|
4108 |
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
|
|
4109 |
/*--- Variable export code ---*/
|
|
4110 |
__Pyx_RefNannyFinishContext();
|
|
4111 |
return 0;
|
|
4112 |
}
|
|
4113 |
|
|
4114 |
static int __Pyx_modinit_function_export_code(void) {
|
|
4115 |
__Pyx_RefNannyDeclarations
|
|
4116 |
__Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
|
|
4117 |
/*--- Function export code ---*/
|
|
4118 |
__Pyx_RefNannyFinishContext();
|
|
4119 |
return 0;
|
|
4120 |
}
|
|
4121 |
|
|
4122 |
static int __Pyx_modinit_type_init_code(void) {
|
|
4123 |
__Pyx_RefNannyDeclarations
|
|
4124 |
__Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
|
|
4125 |
/*--- Type init code ---*/
|
|
4126 |
__Pyx_RefNannyFinishContext();
|
|
4127 |
return 0;
|
|
4128 |
}
|
|
4129 |
|
|
4130 |
static int __Pyx_modinit_type_import_code(void) {
|
|
4131 |
__Pyx_RefNannyDeclarations
|
|
4132 |
PyObject *__pyx_t_1 = NULL;
|
|
4133 |
int __pyx_lineno = 0;
|
|
4134 |
const char *__pyx_filename = NULL;
|
|
4135 |
int __pyx_clineno = 0;
|
|
4136 |
__Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
|
|
4137 |
/*--- Type import code ---*/
|
|
4138 |
__pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error)
|
|
4139 |
__Pyx_GOTREF(__pyx_t_1);
|
|
4140 |
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
|
|
4141 |
#if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
|
|
4142 |
sizeof(PyTypeObject),
|
|
4143 |
#else
|
|
4144 |
sizeof(PyHeapTypeObject),
|
|
4145 |
#endif
|
|
4146 |
__Pyx_ImportType_CheckSize_Warn);
|
|
4147 |
if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(1, 9, __pyx_L1_error)
|
|
4148 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
4149 |
__pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
|
|
4150 |
__Pyx_GOTREF(__pyx_t_1);
|
|
4151 |
__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
|
|
4152 |
if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(2, 8, __pyx_L1_error)
|
|
4153 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
4154 |
__pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 15, __pyx_L1_error)
|
|
4155 |
__Pyx_GOTREF(__pyx_t_1);
|
|
4156 |
__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
|
|
4157 |
if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(3, 15, __pyx_L1_error)
|
|
4158 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
4159 |
__Pyx_RefNannyFinishContext();
|
|
4160 |
return 0;
|
|
4161 |
__pyx_L1_error:;
|
|
4162 |
__Pyx_XDECREF(__pyx_t_1);
|
|
4163 |
__Pyx_RefNannyFinishContext();
|
|
4164 |
return -1;
|
|
4165 |
}
|
|
4166 |
|
|
4167 |
static int __Pyx_modinit_variable_import_code(void) {
|
|
4168 |
__Pyx_RefNannyDeclarations
|
|
4169 |
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
|
|
4170 |
/*--- Variable import code ---*/
|
|
4171 |
__Pyx_RefNannyFinishContext();
|
|
4172 |
return 0;
|
|
4173 |
}
|
|
4174 |
|
|
4175 |
static int __Pyx_modinit_function_import_code(void) {
|
|
4176 |
__Pyx_RefNannyDeclarations
|
|
4177 |
__Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
|
|
4178 |
/*--- Function import code ---*/
|
|
4179 |
__Pyx_RefNannyFinishContext();
|
|
4180 |
return 0;
|
|
4181 |
}
|
|
4182 |
|
|
4183 |
|
|
4184 |
#ifndef CYTHON_NO_PYINIT_EXPORT
|
|
4185 |
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
|
|
4186 |
#elif PY_MAJOR_VERSION < 3
|
|
4187 |
#ifdef __cplusplus
|
|
4188 |
#define __Pyx_PyMODINIT_FUNC extern "C" void
|
|
4189 |
#else
|
|
4190 |
#define __Pyx_PyMODINIT_FUNC void
|
|
4191 |
#endif
|
|
4192 |
#else
|
|
4193 |
#ifdef __cplusplus
|
|
4194 |
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
|
|
4195 |
#else
|
|
4196 |
#define __Pyx_PyMODINIT_FUNC PyObject *
|
|
4197 |
#endif
|
|
4198 |
#endif
|
|
4199 |
|
|
4200 |
|
|
4201 |
#if PY_MAJOR_VERSION < 3
|
|
4202 |
__Pyx_PyMODINIT_FUNC initlargeint(void) CYTHON_SMALL_CODE; /*proto*/
|
|
4203 |
__Pyx_PyMODINIT_FUNC initlargeint(void)
|
|
4204 |
#else
|
|
4205 |
__Pyx_PyMODINIT_FUNC PyInit_largeint(void) CYTHON_SMALL_CODE; /*proto*/
|
|
4206 |
__Pyx_PyMODINIT_FUNC PyInit_largeint(void)
|
|
4207 |
#if CYTHON_PEP489_MULTI_PHASE_INIT
|
|
4208 |
{
|
|
4209 |
return PyModuleDef_Init(&__pyx_moduledef);
|
|
4210 |
}
|
|
4211 |
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
|
|
4212 |
#if PY_VERSION_HEX >= 0x030700A1
|
|
4213 |
static PY_INT64_T main_interpreter_id = -1;
|
|
4214 |
PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
|
|
4215 |
if (main_interpreter_id == -1) {
|
|
4216 |
main_interpreter_id = current_id;
|
|
4217 |
return (unlikely(current_id == -1)) ? -1 : 0;
|
|
4218 |
} else if (unlikely(main_interpreter_id != current_id))
|
|
4219 |
#else
|
|
4220 |
static PyInterpreterState *main_interpreter = NULL;
|
|
4221 |
PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
|
|
4222 |
if (!main_interpreter) {
|
|
4223 |
main_interpreter = current_interpreter;
|
|
4224 |
} else if (unlikely(main_interpreter != current_interpreter))
|
|
4225 |
#endif
|
|
4226 |
{
|
|
4227 |
PyErr_SetString(
|
|
4228 |
PyExc_ImportError,
|
|
4229 |
"Interpreter change detected - this module can only be loaded into one interpreter per process.");
|
|
4230 |
return -1;
|
|
4231 |
}
|
|
4232 |
return 0;
|
|
4233 |
}
|
|
4234 |
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
|
|
4235 |
PyObject *value = PyObject_GetAttrString(spec, from_name);
|
|
4236 |
int result = 0;
|
|
4237 |
if (likely(value)) {
|
|
4238 |
if (allow_none || value != Py_None) {
|
|
4239 |
result = PyDict_SetItemString(moddict, to_name, value);
|
|
4240 |
}
|
|
4241 |
Py_DECREF(value);
|
|
4242 |
} else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
|
4243 |
PyErr_Clear();
|
|
4244 |
} else {
|
|
4245 |
result = -1;
|
|
4246 |
}
|
|
4247 |
return result;
|
|
4248 |
}
|
|
4249 |
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
|
|
4250 |
PyObject *module = NULL, *moddict, *modname;
|
|
4251 |
if (__Pyx_check_single_interpreter())
|
|
4252 |
return NULL;
|
|
4253 |
if (__pyx_m)
|
|
4254 |
return __Pyx_NewRef(__pyx_m);
|
|
4255 |
modname = PyObject_GetAttrString(spec, "name");
|
|
4256 |
if (unlikely(!modname)) goto bad;
|
|
4257 |
module = PyModule_NewObject(modname);
|
|
4258 |
Py_DECREF(modname);
|
|
4259 |
if (unlikely(!module)) goto bad;
|
|
4260 |
moddict = PyModule_GetDict(module);
|
|
4261 |
if (unlikely(!moddict)) goto bad;
|
|
4262 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
|
|
4263 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
|
|
4264 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
|
|
4265 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
|
|
4266 |
return module;
|
|
4267 |
bad:
|
|
4268 |
Py_XDECREF(module);
|
|
4269 |
return NULL;
|
|
4270 |
}
|
|
4271 |
|
|
4272 |
|
|
4273 |
static CYTHON_SMALL_CODE int __pyx_pymod_exec_largeint(PyObject *__pyx_pyinit_module)
|
|
4274 |
#endif
|
|
4275 |
#endif
|
|
4276 |
{
|
|
4277 |
PyObject *__pyx_t_1 = NULL;
|
|
4278 |
PyObject *__pyx_t_2 = NULL;
|
|
4279 |
int __pyx_lineno = 0;
|
|
4280 |
const char *__pyx_filename = NULL;
|
|
4281 |
int __pyx_clineno = 0;
|
|
4282 |
__Pyx_RefNannyDeclarations
|
|
4283 |
#if CYTHON_PEP489_MULTI_PHASE_INIT
|
|
4284 |
if (__pyx_m) {
|
|
4285 |
if (__pyx_m == __pyx_pyinit_module) return 0;
|
|
4286 |
PyErr_SetString(PyExc_RuntimeError, "Module 'largeint' has already been imported. Re-initialisation is not supported.");
|
|
4287 |
return -1;
|
|
4288 |
}
|
|
4289 |
#elif PY_MAJOR_VERSION >= 3
|
|
4290 |
if (__pyx_m) return __Pyx_NewRef(__pyx_m);
|
|
4291 |
#endif
|
|
4292 |
#if CYTHON_REFNANNY
|
|
4293 |
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
|
|
4294 |
if (!__Pyx_RefNanny) {
|
|
4295 |
PyErr_Clear();
|
|
4296 |
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
|
|
4297 |
if (!__Pyx_RefNanny)
|
|
4298 |
Py_FatalError("failed to import 'refnanny' module");
|
|
4299 |
}
|
|
4300 |
#endif
|
|
4301 |
__Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_largeint(void)", 0);
|
|
4302 |
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4303 |
#ifdef __Pxy_PyFrame_Initialize_Offsets
|
|
4304 |
__Pxy_PyFrame_Initialize_Offsets();
|
|
4305 |
#endif
|
|
4306 |
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4307 |
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4308 |
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4309 |
#ifdef __Pyx_CyFunction_USED
|
|
4310 |
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4311 |
#endif
|
|
4312 |
#ifdef __Pyx_FusedFunction_USED
|
|
4313 |
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4314 |
#endif
|
|
4315 |
#ifdef __Pyx_Coroutine_USED
|
|
4316 |
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4317 |
#endif
|
|
4318 |
#ifdef __Pyx_Generator_USED
|
|
4319 |
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4320 |
#endif
|
|
4321 |
#ifdef __Pyx_AsyncGen_USED
|
|
4322 |
if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4323 |
#endif
|
|
4324 |
#ifdef __Pyx_StopAsyncIteration_USED
|
|
4325 |
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4326 |
#endif
|
|
4327 |
/*--- Library function declarations ---*/
|
|
4328 |
/*--- Threads initialization code ---*/
|
|
4329 |
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
|
|
4330 |
#ifdef WITH_THREAD /* Python build with threading support? */
|
|
4331 |
PyEval_InitThreads();
|
|
4332 |
#endif
|
|
4333 |
#endif
|
|
4334 |
/*--- Module creation code ---*/
|
|
4335 |
#if CYTHON_PEP489_MULTI_PHASE_INIT
|
|
4336 |
__pyx_m = __pyx_pyinit_module;
|
|
4337 |
Py_INCREF(__pyx_m);
|
|
4338 |
#else
|
|
4339 |
#if PY_MAJOR_VERSION < 3
|
|
4340 |
__pyx_m = Py_InitModule4("largeint", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
|
|
4341 |
#else
|
|
4342 |
__pyx_m = PyModule_Create(&__pyx_moduledef);
|
|
4343 |
#endif
|
|
4344 |
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4345 |
#endif
|
|
4346 |
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4347 |
Py_INCREF(__pyx_d);
|
|
4348 |
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4349 |
Py_INCREF(__pyx_b);
|
|
4350 |
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4351 |
Py_INCREF(__pyx_cython_runtime);
|
|
4352 |
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
|
|
4353 |
/*--- Initialize various global constants etc. ---*/
|
|
4354 |
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4355 |
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
|
|
4356 |
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4357 |
#endif
|
|
4358 |
if (__pyx_module_is_main_clickhouse_driver__columns__largeint) {
|
|
4359 |
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4360 |
}
|
|
4361 |
#if PY_MAJOR_VERSION >= 3
|
|
4362 |
{
|
|
4363 |
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4364 |
if (!PyDict_GetItemString(modules, "clickhouse_driver.columns.largeint")) {
|
|
4365 |
if (unlikely(PyDict_SetItemString(modules, "clickhouse_driver.columns.largeint", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4366 |
}
|
|
4367 |
}
|
|
4368 |
#endif
|
|
4369 |
/*--- Builtin init code ---*/
|
|
4370 |
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4371 |
/*--- Constants init code ---*/
|
|
4372 |
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4373 |
/*--- Global type/function init code ---*/
|
|
4374 |
(void)__Pyx_modinit_global_init_code();
|
|
4375 |
(void)__Pyx_modinit_variable_export_code();
|
|
4376 |
(void)__Pyx_modinit_function_export_code();
|
|
4377 |
(void)__Pyx_modinit_type_init_code();
|
|
4378 |
if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4379 |
(void)__Pyx_modinit_variable_import_code();
|
|
4380 |
(void)__Pyx_modinit_function_import_code();
|
|
4381 |
/*--- Execution code ---*/
|
|
4382 |
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
|
|
4383 |
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4384 |
#endif
|
|
4385 |
|
|
4386 |
/* "clickhouse_driver/columns/largeint.pyx":4
|
|
4387 |
* from cpython.tuple cimport PyTuple_New, PyTuple_SET_ITEM
|
|
4388 |
*
|
|
4389 |
* from .. import writer # <<<<<<<<<<<<<<
|
|
4390 |
*
|
|
4391 |
* cpdef object MAX_UINT64 = writer.MAX_UINT64
|
|
4392 |
*/
|
|
4393 |
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
|
|
4394 |
__Pyx_GOTREF(__pyx_t_1);
|
|
4395 |
__Pyx_INCREF(__pyx_n_s_writer);
|
|
4396 |
__Pyx_GIVEREF(__pyx_n_s_writer);
|
|
4397 |
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_writer);
|
|
4398 |
__pyx_t_2 = __Pyx_Import(__pyx_n_s_, __pyx_t_1, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
|
|
4399 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4400 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
4401 |
__pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
|
|
4402 |
__Pyx_GOTREF(__pyx_t_1);
|
|
4403 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_writer, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
|
|
4404 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
4405 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4406 |
|
|
4407 |
/* "clickhouse_driver/columns/largeint.pyx":6
|
|
4408 |
* from .. import writer
|
|
4409 |
*
|
|
4410 |
* cpdef object MAX_UINT64 = writer.MAX_UINT64 # <<<<<<<<<<<<<<
|
|
4411 |
* cpdef object MAX_INT64 = writer.MAX_INT64
|
|
4412 |
*
|
|
4413 |
*/
|
|
4414 |
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
|
|
4415 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4416 |
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_MAX_UINT64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
|
|
4417 |
__Pyx_GOTREF(__pyx_t_1);
|
|
4418 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4419 |
__Pyx_XGOTREF(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64);
|
|
4420 |
__Pyx_DECREF_SET(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_UINT64, __pyx_t_1);
|
|
4421 |
__Pyx_GIVEREF(__pyx_t_1);
|
|
4422 |
__pyx_t_1 = 0;
|
|
4423 |
|
|
4424 |
/* "clickhouse_driver/columns/largeint.pyx":7
|
|
4425 |
*
|
|
4426 |
* cpdef object MAX_UINT64 = writer.MAX_UINT64
|
|
4427 |
* cpdef object MAX_INT64 = writer.MAX_INT64 # <<<<<<<<<<<<<<
|
|
4428 |
*
|
|
4429 |
*
|
|
4430 |
*/
|
|
4431 |
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_writer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
|
|
4432 |
__Pyx_GOTREF(__pyx_t_1);
|
|
4433 |
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_MAX_INT64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
|
|
4434 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4435 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
4436 |
__Pyx_XGOTREF(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_INT64);
|
|
4437 |
__Pyx_DECREF_SET(__pyx_v_17clickhouse_driver_7columns_8largeint_MAX_INT64, __pyx_t_2);
|
|
4438 |
__Pyx_GIVEREF(__pyx_t_2);
|
|
4439 |
__pyx_t_2 = 0;
|
|
4440 |
|
|
4441 |
/* "clickhouse_driver/columns/largeint.pyx":10
|
|
4442 |
*
|
|
4443 |
*
|
|
4444 |
* def int128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4445 |
* cdef unsigned int factor = 2
|
|
4446 |
* items = PyTuple_New(n_items)
|
|
4447 |
*/
|
|
4448 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_1int128_from_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
|
|
4449 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4450 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_int128_from_quads, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
|
|
4451 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4452 |
|
|
4453 |
/* "clickhouse_driver/columns/largeint.pyx":36
|
|
4454 |
*
|
|
4455 |
*
|
|
4456 |
* def int128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4457 |
* cdef unsigned int factor = 2
|
|
4458 |
* quad_items = PyTuple_New(n_items * factor)
|
|
4459 |
*/
|
|
4460 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_3int128_to_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
|
|
4461 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4462 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_int128_to_quads, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
|
|
4463 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4464 |
|
|
4465 |
/* "clickhouse_driver/columns/largeint.pyx":70
|
|
4466 |
*
|
|
4467 |
*
|
|
4468 |
* def uint128_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4469 |
* cdef unsigned int factor = 2
|
|
4470 |
* items = PyTuple_New(n_items)
|
|
4471 |
*/
|
|
4472 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_5uint128_from_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
|
|
4473 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4474 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint128_from_quads, __pyx_t_2) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
|
|
4475 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4476 |
|
|
4477 |
/* "clickhouse_driver/columns/largeint.pyx":87
|
|
4478 |
*
|
|
4479 |
*
|
|
4480 |
* def uint128_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4481 |
* cdef unsigned int factor = 2
|
|
4482 |
* quad_items = PyTuple_New(n_items * factor)
|
|
4483 |
*/
|
|
4484 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_7uint128_to_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
|
|
4485 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4486 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint128_to_quads, __pyx_t_2) < 0) __PYX_ERR(0, 87, __pyx_L1_error)
|
|
4487 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4488 |
|
|
4489 |
/* "clickhouse_driver/columns/largeint.pyx":111
|
|
4490 |
*
|
|
4491 |
*
|
|
4492 |
* def int256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4493 |
* cdef unsigned int factor = 4
|
|
4494 |
* items = PyTuple_New(n_items)
|
|
4495 |
*/
|
|
4496 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_9int256_from_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
|
|
4497 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4498 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_int256_from_quads, __pyx_t_2) < 0) __PYX_ERR(0, 111, __pyx_L1_error)
|
|
4499 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4500 |
|
|
4501 |
/* "clickhouse_driver/columns/largeint.pyx":144
|
|
4502 |
*
|
|
4503 |
*
|
|
4504 |
* def int256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4505 |
* cdef unsigned int factor = 4
|
|
4506 |
* quad_items = PyTuple_New(n_items * factor)
|
|
4507 |
*/
|
|
4508 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_11int256_to_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
4509 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4510 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_int256_to_quads, __pyx_t_2) < 0) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
4511 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4512 |
|
|
4513 |
/* "clickhouse_driver/columns/largeint.pyx":194
|
|
4514 |
*
|
|
4515 |
*
|
|
4516 |
* def uint256_from_quads(quad_items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4517 |
* cdef unsigned int factor = 4
|
|
4518 |
* items = PyTuple_New(n_items)
|
|
4519 |
*/
|
|
4520 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_13uint256_from_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
|
|
4521 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4522 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint256_from_quads, __pyx_t_2) < 0) __PYX_ERR(0, 194, __pyx_L1_error)
|
|
4523 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4524 |
|
|
4525 |
/* "clickhouse_driver/columns/largeint.pyx":216
|
|
4526 |
*
|
|
4527 |
*
|
|
4528 |
* def uint256_to_quads(items, unsigned long long n_items): # <<<<<<<<<<<<<<
|
|
4529 |
* cdef unsigned int factor = 4
|
|
4530 |
* quad_items = PyTuple_New(n_items * factor)
|
|
4531 |
*/
|
|
4532 |
__pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_17clickhouse_driver_7columns_8largeint_15uint256_to_quads, NULL, __pyx_n_s_clickhouse_driver_columns_largei_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
|
|
4533 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4534 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint256_to_quads, __pyx_t_2) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
|
|
4535 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4536 |
|
|
4537 |
/* "clickhouse_driver/columns/largeint.pyx":1
|
|
4538 |
* from cpython cimport Py_INCREF # <<<<<<<<<<<<<<
|
|
4539 |
* from cpython.tuple cimport PyTuple_New, PyTuple_SET_ITEM
|
|
4540 |
*
|
|
4541 |
*/
|
|
4542 |
__pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4543 |
__Pyx_GOTREF(__pyx_t_2);
|
|
4544 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
|
|
4545 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
4546 |
|
|
4547 |
/*--- Wrapped vars code ---*/
|
|
4548 |
|
|
4549 |
goto __pyx_L0;
|
|
4550 |
__pyx_L1_error:;
|
|
4551 |
__Pyx_XDECREF(__pyx_t_1);
|
|
4552 |
__Pyx_XDECREF(__pyx_t_2);
|
|
4553 |
if (__pyx_m) {
|
|
4554 |
if (__pyx_d) {
|
|
4555 |
__Pyx_AddTraceback("init clickhouse_driver.columns.largeint", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
4556 |
}
|
|
4557 |
Py_CLEAR(__pyx_m);
|
|
4558 |
} else if (!PyErr_Occurred()) {
|
|
4559 |
PyErr_SetString(PyExc_ImportError, "init clickhouse_driver.columns.largeint");
|
|
4560 |
}
|
|
4561 |
__pyx_L0:;
|
|
4562 |
__Pyx_RefNannyFinishContext();
|
|
4563 |
#if CYTHON_PEP489_MULTI_PHASE_INIT
|
|
4564 |
return (__pyx_m != NULL) ? 0 : -1;
|
|
4565 |
#elif PY_MAJOR_VERSION >= 3
|
|
4566 |
return __pyx_m;
|
|
4567 |
#else
|
|
4568 |
return;
|
|
4569 |
#endif
|
|
4570 |
}
|
|
4571 |
|
|
4572 |
/* --- Runtime support code --- */
|
|
4573 |
/* Refnanny */
|
|
4574 |
#if CYTHON_REFNANNY
|
|
4575 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
|
|
4576 |
PyObject *m = NULL, *p = NULL;
|
|
4577 |
void *r = NULL;
|
|
4578 |
m = PyImport_ImportModule(modname);
|
|
4579 |
if (!m) goto end;
|
|
4580 |
p = PyObject_GetAttrString(m, "RefNannyAPI");
|
|
4581 |
if (!p) goto end;
|
|
4582 |
r = PyLong_AsVoidPtr(p);
|
|
4583 |
end:
|
|
4584 |
Py_XDECREF(p);
|
|
4585 |
Py_XDECREF(m);
|
|
4586 |
return (__Pyx_RefNannyAPIStruct *)r;
|
|
4587 |
}
|
|
4588 |
#endif
|
|
4589 |
|
|
4590 |
/* PyObjectGetAttrStr */
|
|
4591 |
#if CYTHON_USE_TYPE_SLOTS
|
|
4592 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
|
|
4593 |
PyTypeObject* tp = Py_TYPE(obj);
|
|
4594 |
if (likely(tp->tp_getattro))
|
|
4595 |
return tp->tp_getattro(obj, attr_name);
|
|
4596 |
#if PY_MAJOR_VERSION < 3
|
|
4597 |
if (likely(tp->tp_getattr))
|
|
4598 |
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
|
|
4599 |
#endif
|
|
4600 |
return PyObject_GetAttr(obj, attr_name);
|
|
4601 |
}
|
|
4602 |
#endif
|
|
4603 |
|
|
4604 |
/* GetBuiltinName */
|
|
4605 |
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
|
|
4606 |
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
|
|
4607 |
if (unlikely(!result)) {
|
|
4608 |
PyErr_Format(PyExc_NameError,
|
|
4609 |
#if PY_MAJOR_VERSION >= 3
|
|
4610 |
"name '%U' is not defined", name);
|
|
4611 |
#else
|
|
4612 |
"name '%.200s' is not defined", PyString_AS_STRING(name));
|
|
4613 |
#endif
|
|
4614 |
}
|
|
4615 |
return result;
|
|
4616 |
}
|
|
4617 |
|
|
4618 |
/* RaiseArgTupleInvalid */
|
|
4619 |
static void __Pyx_RaiseArgtupleInvalid(
|
|
4620 |
const char* func_name,
|
|
4621 |
int exact,
|
|
4622 |
Py_ssize_t num_min,
|
|
4623 |
Py_ssize_t num_max,
|
|
4624 |
Py_ssize_t num_found)
|
|
4625 |
{
|
|
4626 |
Py_ssize_t num_expected;
|
|
4627 |
const char *more_or_less;
|
|
4628 |
if (num_found < num_min) {
|
|
4629 |
num_expected = num_min;
|
|
4630 |
more_or_less = "at least";
|
|
4631 |
} else {
|
|
4632 |
num_expected = num_max;
|
|
4633 |
more_or_less = "at most";
|
|
4634 |
}
|
|
4635 |
if (exact) {
|
|
4636 |
more_or_less = "exactly";
|
|
4637 |
}
|
|
4638 |
PyErr_Format(PyExc_TypeError,
|
|
4639 |
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
|
|
4640 |
func_name, more_or_less, num_expected,
|
|
4641 |
(num_expected == 1) ? "" : "s", num_found);
|
|
4642 |
}
|
|
4643 |
|
|
4644 |
/* RaiseDoubleKeywords */
|
|
4645 |
static void __Pyx_RaiseDoubleKeywordsError(
|
|
4646 |
const char* func_name,
|
|
4647 |
PyObject* kw_name)
|
|
4648 |
{
|
|
4649 |
PyErr_Format(PyExc_TypeError,
|
|
4650 |
#if PY_MAJOR_VERSION >= 3
|
|
4651 |
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
|
|
4652 |
#else
|
|
4653 |
"%s() got multiple values for keyword argument '%s'", func_name,
|
|
4654 |
PyString_AsString(kw_name));
|
|
4655 |
#endif
|
|
4656 |
}
|
|
4657 |
|
|
4658 |
/* ParseKeywords */
|
|
4659 |
static int __Pyx_ParseOptionalKeywords(
|
|
4660 |
PyObject *kwds,
|
|
4661 |
PyObject **argnames[],
|
|
4662 |
PyObject *kwds2,
|
|
4663 |
PyObject *values[],
|
|
4664 |
Py_ssize_t num_pos_args,
|
|
4665 |
const char* function_name)
|
|
4666 |
{
|
|
4667 |
PyObject *key = 0, *value = 0;
|
|
4668 |
Py_ssize_t pos = 0;
|
|
4669 |
PyObject*** name;
|
|
4670 |
PyObject*** first_kw_arg = argnames + num_pos_args;
|
|
4671 |
while (PyDict_Next(kwds, &pos, &key, &value)) {
|
|
4672 |
name = first_kw_arg;
|
|
4673 |
while (*name && (**name != key)) name++;
|
|
4674 |
if (*name) {
|
|
4675 |
values[name-argnames] = value;
|
|
4676 |
continue;
|
|
4677 |
}
|
|
4678 |
name = first_kw_arg;
|
|
4679 |
#if PY_MAJOR_VERSION < 3
|
|
4680 |
if (likely(PyString_Check(key))) {
|
|
4681 |
while (*name) {
|
|
4682 |
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
|
|
4683 |
&& _PyString_Eq(**name, key)) {
|
|
4684 |
values[name-argnames] = value;
|
|
4685 |
break;
|
|
4686 |
}
|
|
4687 |
name++;
|
|
4688 |
}
|
|
4689 |
if (*name) continue;
|
|
4690 |
else {
|
|
4691 |
PyObject*** argname = argnames;
|
|
4692 |
while (argname != first_kw_arg) {
|
|
4693 |
if ((**argname == key) || (
|
|
4694 |
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
|
|
4695 |
&& _PyString_Eq(**argname, key))) {
|
|
4696 |
goto arg_passed_twice;
|
|
4697 |
}
|
|
4698 |
argname++;
|
|
4699 |
}
|
|
4700 |
}
|
|
4701 |
} else
|
|
4702 |
#endif
|
|
4703 |
if (likely(PyUnicode_Check(key))) {
|
|
4704 |
while (*name) {
|
|
4705 |
int cmp = (**name == key) ? 0 :
|
|
4706 |
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
|
|
4707 |
(__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
|
|
4708 |
#endif
|
|
4709 |
PyUnicode_Compare(**name, key);
|
|
4710 |
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
|
|
4711 |
if (cmp == 0) {
|
|
4712 |
values[name-argnames] = value;
|
|
4713 |
break;
|
|
4714 |
}
|
|
4715 |
name++;
|
|
4716 |
}
|
|
4717 |
if (*name) continue;
|
|
4718 |
else {
|
|
4719 |
PyObject*** argname = argnames;
|
|
4720 |
while (argname != first_kw_arg) {
|
|
4721 |
int cmp = (**argname == key) ? 0 :
|
|
4722 |
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
|
|
4723 |
(__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
|
|
4724 |
#endif
|
|
4725 |
PyUnicode_Compare(**argname, key);
|
|
4726 |
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
|
|
4727 |
if (cmp == 0) goto arg_passed_twice;
|
|
4728 |
argname++;
|
|
4729 |
}
|
|
4730 |
}
|
|
4731 |
} else
|
|
4732 |
goto invalid_keyword_type;
|
|
4733 |
if (kwds2) {
|
|
4734 |
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
|
|
4735 |
} else {
|
|
4736 |
goto invalid_keyword;
|
|
4737 |
}
|
|
4738 |
}
|
|
4739 |
return 0;
|
|
4740 |
arg_passed_twice:
|
|
4741 |
__Pyx_RaiseDoubleKeywordsError(function_name, key);
|
|
4742 |
goto bad;
|
|
4743 |
invalid_keyword_type:
|
|
4744 |
PyErr_Format(PyExc_TypeError,
|
|
4745 |
"%.200s() keywords must be strings", function_name);
|
|
4746 |
goto bad;
|
|
4747 |
invalid_keyword:
|
|
4748 |
PyErr_Format(PyExc_TypeError,
|
|
4749 |
#if PY_MAJOR_VERSION < 3
|
|
4750 |
"%.200s() got an unexpected keyword argument '%.200s'",
|
|
4751 |
function_name, PyString_AsString(key));
|
|
4752 |
#else
|
|
4753 |
"%s() got an unexpected keyword argument '%U'",
|
|
4754 |
function_name, key);
|
|
4755 |
#endif
|
|
4756 |
bad:
|
|
4757 |
return -1;
|
|
4758 |
}
|
|
4759 |
|
|
4760 |
/* GetItemInt */
|
|
4761 |
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
|
|
4762 |
PyObject *r;
|
|
4763 |
if (!j) return NULL;
|
|
4764 |
r = PyObject_GetItem(o, j);
|
|
4765 |
Py_DECREF(j);
|
|
4766 |
return r;
|
|
4767 |
}
|
|
4768 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
|
|
4769 |
CYTHON_NCP_UNUSED int wraparound,
|
|
4770 |
CYTHON_NCP_UNUSED int boundscheck) {
|
|
4771 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
4772 |
Py_ssize_t wrapped_i = i;
|
|
4773 |
if (wraparound & unlikely(i < 0)) {
|
|
4774 |
wrapped_i += PyList_GET_SIZE(o);
|
|
4775 |
}
|
|
4776 |
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
|
|
4777 |
PyObject *r = PyList_GET_ITEM(o, wrapped_i);
|
|
4778 |
Py_INCREF(r);
|
|
4779 |
return r;
|
|
4780 |
}
|
|
4781 |
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
|
|
4782 |
#else
|
|
4783 |
return PySequence_GetItem(o, i);
|
|
4784 |
#endif
|
|
4785 |
}
|
|
4786 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
|
|
4787 |
CYTHON_NCP_UNUSED int wraparound,
|
|
4788 |
CYTHON_NCP_UNUSED int boundscheck) {
|
|
4789 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
4790 |
Py_ssize_t wrapped_i = i;
|
|
4791 |
if (wraparound & unlikely(i < 0)) {
|
|
4792 |
wrapped_i += PyTuple_GET_SIZE(o);
|
|
4793 |
}
|
|
4794 |
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
|
|
4795 |
PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
|
|
4796 |
Py_INCREF(r);
|
|
4797 |
return r;
|
|
4798 |
}
|
|
4799 |
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
|
|
4800 |
#else
|
|
4801 |
return PySequence_GetItem(o, i);
|
|
4802 |
#endif
|
|
4803 |
}
|
|
4804 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
|
|
4805 |
CYTHON_NCP_UNUSED int wraparound,
|
|
4806 |
CYTHON_NCP_UNUSED int boundscheck) {
|
|
4807 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
|
|
4808 |
if (is_list || PyList_CheckExact(o)) {
|
|
4809 |
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
|
|
4810 |
if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
|
|
4811 |
PyObject *r = PyList_GET_ITEM(o, n);
|
|
4812 |
Py_INCREF(r);
|
|
4813 |
return r;
|
|
4814 |
}
|
|
4815 |
}
|
|
4816 |
else if (PyTuple_CheckExact(o)) {
|
|
4817 |
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
|
|
4818 |
if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
|
|
4819 |
PyObject *r = PyTuple_GET_ITEM(o, n);
|
|
4820 |
Py_INCREF(r);
|
|
4821 |
return r;
|
|
4822 |
}
|
|
4823 |
} else {
|
|
4824 |
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
|
|
4825 |
if (likely(m && m->sq_item)) {
|
|
4826 |
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
|
|
4827 |
Py_ssize_t l = m->sq_length(o);
|
|
4828 |
if (likely(l >= 0)) {
|
|
4829 |
i += l;
|
|
4830 |
} else {
|
|
4831 |
if (!PyErr_ExceptionMatches(PyExc_OverflowError))
|
|
4832 |
return NULL;
|
|
4833 |
PyErr_Clear();
|
|
4834 |
}
|
|
4835 |
}
|
|
4836 |
return m->sq_item(o, i);
|
|
4837 |
}
|
|
4838 |
}
|
|
4839 |
#else
|
|
4840 |
if (is_list || PySequence_Check(o)) {
|
|
4841 |
return PySequence_GetItem(o, i);
|
|
4842 |
}
|
|
4843 |
#endif
|
|
4844 |
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
|
|
4845 |
}
|
|
4846 |
|
|
4847 |
/* PyIntBinop */
|
|
4848 |
#if !CYTHON_COMPILING_IN_PYPY
|
|
4849 |
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
|
|
4850 |
(void)inplace;
|
|
4851 |
(void)zerodivision_check;
|
|
4852 |
#if PY_MAJOR_VERSION < 3
|
|
4853 |
if (likely(PyInt_CheckExact(op1))) {
|
|
4854 |
const long b = intval;
|
|
4855 |
long x;
|
|
4856 |
long a = PyInt_AS_LONG(op1);
|
|
4857 |
x = (long)((unsigned long)a - b);
|
|
4858 |
if (likely((x^a) >= 0 || (x^~b) >= 0))
|
|
4859 |
return PyInt_FromLong(x);
|
|
4860 |
return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
|
|
4861 |
}
|
|
4862 |
#endif
|
|
4863 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
4864 |
if (likely(PyLong_CheckExact(op1))) {
|
|
4865 |
const long b = intval;
|
|
4866 |
long a, x;
|
|
4867 |
#ifdef HAVE_LONG_LONG
|
|
4868 |
const PY_LONG_LONG llb = intval;
|
|
4869 |
PY_LONG_LONG lla, llx;
|
|
4870 |
#endif
|
|
4871 |
const digit* digits = ((PyLongObject*)op1)->ob_digit;
|
|
4872 |
const Py_ssize_t size = Py_SIZE(op1);
|
|
4873 |
if (likely(__Pyx_sst_abs(size) <= 1)) {
|
|
4874 |
a = likely(size) ? digits[0] : 0;
|
|
4875 |
if (size == -1) a = -a;
|
|
4876 |
} else {
|
|
4877 |
switch (size) {
|
|
4878 |
case -2:
|
|
4879 |
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
|
|
4880 |
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
|
|
4881 |
break;
|
|
4882 |
#ifdef HAVE_LONG_LONG
|
|
4883 |
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
|
|
4884 |
lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
4885 |
goto long_long;
|
|
4886 |
#endif
|
|
4887 |
}
|
|
4888 |
CYTHON_FALLTHROUGH;
|
|
4889 |
case 2:
|
|
4890 |
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
|
|
4891 |
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
|
|
4892 |
break;
|
|
4893 |
#ifdef HAVE_LONG_LONG
|
|
4894 |
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
|
|
4895 |
lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
4896 |
goto long_long;
|
|
4897 |
#endif
|
|
4898 |
}
|
|
4899 |
CYTHON_FALLTHROUGH;
|
|
4900 |
case -3:
|
|
4901 |
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
|
|
4902 |
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
|
|
4903 |
break;
|
|
4904 |
#ifdef HAVE_LONG_LONG
|
|
4905 |
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
|
|
4906 |
lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
4907 |
goto long_long;
|
|
4908 |
#endif
|
|
4909 |
}
|
|
4910 |
CYTHON_FALLTHROUGH;
|
|
4911 |
case 3:
|
|
4912 |
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
|
|
4913 |
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
|
|
4914 |
break;
|
|
4915 |
#ifdef HAVE_LONG_LONG
|
|
4916 |
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
|
|
4917 |
lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
4918 |
goto long_long;
|
|
4919 |
#endif
|
|
4920 |
}
|
|
4921 |
CYTHON_FALLTHROUGH;
|
|
4922 |
case -4:
|
|
4923 |
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
|
|
4924 |
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
|
|
4925 |
break;
|
|
4926 |
#ifdef HAVE_LONG_LONG
|
|
4927 |
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
|
|
4928 |
lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
4929 |
goto long_long;
|
|
4930 |
#endif
|
|
4931 |
}
|
|
4932 |
CYTHON_FALLTHROUGH;
|
|
4933 |
case 4:
|
|
4934 |
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
|
|
4935 |
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
|
|
4936 |
break;
|
|
4937 |
#ifdef HAVE_LONG_LONG
|
|
4938 |
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
|
|
4939 |
lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
4940 |
goto long_long;
|
|
4941 |
#endif
|
|
4942 |
}
|
|
4943 |
CYTHON_FALLTHROUGH;
|
|
4944 |
default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
|
|
4945 |
}
|
|
4946 |
}
|
|
4947 |
x = a - b;
|
|
4948 |
return PyLong_FromLong(x);
|
|
4949 |
#ifdef HAVE_LONG_LONG
|
|
4950 |
long_long:
|
|
4951 |
llx = lla - llb;
|
|
4952 |
return PyLong_FromLongLong(llx);
|
|
4953 |
#endif
|
|
4954 |
|
|
4955 |
|
|
4956 |
}
|
|
4957 |
#endif
|
|
4958 |
if (PyFloat_CheckExact(op1)) {
|
|
4959 |
const long b = intval;
|
|
4960 |
double a = PyFloat_AS_DOUBLE(op1);
|
|
4961 |
double result;
|
|
4962 |
PyFPE_START_PROTECT("subtract", return NULL)
|
|
4963 |
result = ((double)a) - (double)b;
|
|
4964 |
PyFPE_END_PROTECT(result)
|
|
4965 |
return PyFloat_FromDouble(result);
|
|
4966 |
}
|
|
4967 |
return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
|
|
4968 |
}
|
|
4969 |
#endif
|
|
4970 |
|
|
4971 |
/* TypeImport */
|
|
4972 |
#ifndef __PYX_HAVE_RT_ImportType
|
|
4973 |
#define __PYX_HAVE_RT_ImportType
|
|
4974 |
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
|
|
4975 |
size_t size, enum __Pyx_ImportType_CheckSize check_size)
|
|
4976 |
{
|
|
4977 |
PyObject *result = 0;
|
|
4978 |
char warning[200];
|
|
4979 |
Py_ssize_t basicsize;
|
|
4980 |
#ifdef Py_LIMITED_API
|
|
4981 |
PyObject *py_basicsize;
|
|
4982 |
#endif
|
|
4983 |
result = PyObject_GetAttrString(module, class_name);
|
|
4984 |
if (!result)
|
|
4985 |
goto bad;
|
|
4986 |
if (!PyType_Check(result)) {
|
|
4987 |
PyErr_Format(PyExc_TypeError,
|
|
4988 |
"%.200s.%.200s is not a type object",
|
|
4989 |
module_name, class_name);
|
|
4990 |
goto bad;
|
|
4991 |
}
|
|
4992 |
#ifndef Py_LIMITED_API
|
|
4993 |
basicsize = ((PyTypeObject *)result)->tp_basicsize;
|
|
4994 |
#else
|
|
4995 |
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
|
|
4996 |
if (!py_basicsize)
|
|
4997 |
goto bad;
|
|
4998 |
basicsize = PyLong_AsSsize_t(py_basicsize);
|
|
4999 |
Py_DECREF(py_basicsize);
|
|
5000 |
py_basicsize = 0;
|
|
5001 |
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
|
|
5002 |
goto bad;
|
|
5003 |
#endif
|
|
5004 |
if ((size_t)basicsize < size) {
|
|
5005 |
PyErr_Format(PyExc_ValueError,
|
|
5006 |
"%.200s.%.200s size changed, may indicate binary incompatibility. "
|
|
5007 |
"Expected %zd from C header, got %zd from PyObject",
|
|
5008 |
module_name, class_name, size, basicsize);
|
|
5009 |
goto bad;
|
|
5010 |
}
|
|
5011 |
if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
|
|
5012 |
PyErr_Format(PyExc_ValueError,
|
|
5013 |
"%.200s.%.200s size changed, may indicate binary incompatibility. "
|
|
5014 |
"Expected %zd from C header, got %zd from PyObject",
|
|
5015 |
module_name, class_name, size, basicsize);
|
|
5016 |
goto bad;
|
|
5017 |
}
|
|
5018 |
else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
|
|
5019 |
PyOS_snprintf(warning, sizeof(warning),
|
|
5020 |
"%s.%s size changed, may indicate binary incompatibility. "
|
|
5021 |
"Expected %zd from C header, got %zd from PyObject",
|
|
5022 |
module_name, class_name, size, basicsize);
|
|
5023 |
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
|
|
5024 |
}
|
|
5025 |
return (PyTypeObject *)result;
|
|
5026 |
bad:
|
|
5027 |
Py_XDECREF(result);
|
|
5028 |
return NULL;
|
|
5029 |
}
|
|
5030 |
#endif
|
|
5031 |
|
|
5032 |
/* Import */
|
|
5033 |
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
|
|
5034 |
PyObject *empty_list = 0;
|
|
5035 |
PyObject *module = 0;
|
|
5036 |
PyObject *global_dict = 0;
|
|
5037 |
PyObject *empty_dict = 0;
|
|
5038 |
PyObject *list;
|
|
5039 |
#if PY_MAJOR_VERSION < 3
|
|
5040 |
PyObject *py_import;
|
|
5041 |
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
|
|
5042 |
if (!py_import)
|
|
5043 |
goto bad;
|
|
5044 |
#endif
|
|
5045 |
if (from_list)
|
|
5046 |
list = from_list;
|
|
5047 |
else {
|
|
5048 |
empty_list = PyList_New(0);
|
|
5049 |
if (!empty_list)
|
|
5050 |
goto bad;
|
|
5051 |
list = empty_list;
|
|
5052 |
}
|
|
5053 |
global_dict = PyModule_GetDict(__pyx_m);
|
|
5054 |
if (!global_dict)
|
|
5055 |
goto bad;
|
|
5056 |
empty_dict = PyDict_New();
|
|
5057 |
if (!empty_dict)
|
|
5058 |
goto bad;
|
|
5059 |
{
|
|
5060 |
#if PY_MAJOR_VERSION >= 3
|
|
5061 |
if (level == -1) {
|
|
5062 |
if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
|
|
5063 |
module = PyImport_ImportModuleLevelObject(
|
|
5064 |
name, global_dict, empty_dict, list, 1);
|
|
5065 |
if (!module) {
|
|
5066 |
if (!PyErr_ExceptionMatches(PyExc_ImportError))
|
|
5067 |
goto bad;
|
|
5068 |
PyErr_Clear();
|
|
5069 |
}
|
|
5070 |
}
|
|
5071 |
level = 0;
|
|
5072 |
}
|
|
5073 |
#endif
|
|
5074 |
if (!module) {
|
|
5075 |
#if PY_MAJOR_VERSION < 3
|
|
5076 |
PyObject *py_level = PyInt_FromLong(level);
|
|
5077 |
if (!py_level)
|
|
5078 |
goto bad;
|
|
5079 |
module = PyObject_CallFunctionObjArgs(py_import,
|
|
5080 |
name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
|
|
5081 |
Py_DECREF(py_level);
|
|
5082 |
#else
|
|
5083 |
module = PyImport_ImportModuleLevelObject(
|
|
5084 |
name, global_dict, empty_dict, list, level);
|
|
5085 |
#endif
|
|
5086 |
}
|
|
5087 |
}
|
|
5088 |
bad:
|
|
5089 |
#if PY_MAJOR_VERSION < 3
|
|
5090 |
Py_XDECREF(py_import);
|
|
5091 |
#endif
|
|
5092 |
Py_XDECREF(empty_list);
|
|
5093 |
Py_XDECREF(empty_dict);
|
|
5094 |
return module;
|
|
5095 |
}
|
|
5096 |
|
|
5097 |
/* ImportFrom */
|
|
5098 |
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
|
|
5099 |
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
|
|
5100 |
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
|
5101 |
PyErr_Format(PyExc_ImportError,
|
|
5102 |
#if PY_MAJOR_VERSION < 3
|
|
5103 |
"cannot import name %.230s", PyString_AS_STRING(name));
|
|
5104 |
#else
|
|
5105 |
"cannot import name %S", name);
|
|
5106 |
#endif
|
|
5107 |
}
|
|
5108 |
return value;
|
|
5109 |
}
|
|
5110 |
|
|
5111 |
/* PyDictVersioning */
|
|
5112 |
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
|
|
5113 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
|
|
5114 |
PyObject *dict = Py_TYPE(obj)->tp_dict;
|
|
5115 |
return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
|
|
5116 |
}
|
|
5117 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
|
|
5118 |
PyObject **dictptr = NULL;
|
|
5119 |
Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
|
|
5120 |
if (offset) {
|
|
5121 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
5122 |
dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
|
|
5123 |
#else
|
|
5124 |
dictptr = _PyObject_GetDictPtr(obj);
|
|
5125 |
#endif
|
|
5126 |
}
|
|
5127 |
return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
|
|
5128 |
}
|
|
5129 |
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
|
|
5130 |
PyObject *dict = Py_TYPE(obj)->tp_dict;
|
|
5131 |
if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
|
|
5132 |
return 0;
|
|
5133 |
return obj_dict_version == __Pyx_get_object_dict_version(obj);
|
|
5134 |
}
|
|
5135 |
#endif
|
|
5136 |
|
|
5137 |
/* GetModuleGlobalName */
|
|
5138 |
#if CYTHON_USE_DICT_VERSIONS
|
|
5139 |
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
|
|
5140 |
#else
|
|
5141 |
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
|
|
5142 |
#endif
|
|
5143 |
{
|
|
5144 |
PyObject *result;
|
|
5145 |
#if !CYTHON_AVOID_BORROWED_REFS
|
|
5146 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
|
|
5147 |
result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
|
|
5148 |
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
|
|
5149 |
if (likely(result)) {
|
|
5150 |
return __Pyx_NewRef(result);
|
|
5151 |
} else if (unlikely(PyErr_Occurred())) {
|
|
5152 |
return NULL;
|
|
5153 |
}
|
|
5154 |
#else
|
|
5155 |
result = PyDict_GetItem(__pyx_d, name);
|
|
5156 |
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
|
|
5157 |
if (likely(result)) {
|
|
5158 |
return __Pyx_NewRef(result);
|
|
5159 |
}
|
|
5160 |
#endif
|
|
5161 |
#else
|
|
5162 |
result = PyObject_GetItem(__pyx_d, name);
|
|
5163 |
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
|
|
5164 |
if (likely(result)) {
|
|
5165 |
return __Pyx_NewRef(result);
|
|
5166 |
}
|
|
5167 |
PyErr_Clear();
|
|
5168 |
#endif
|
|
5169 |
return __Pyx_GetBuiltinName(name);
|
|
5170 |
}
|
|
5171 |
|
|
5172 |
/* PyErrFetchRestore */
|
|
5173 |
#if CYTHON_FAST_THREAD_STATE
|
|
5174 |
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
|
|
5175 |
PyObject *tmp_type, *tmp_value, *tmp_tb;
|
|
5176 |
tmp_type = tstate->curexc_type;
|
|
5177 |
tmp_value = tstate->curexc_value;
|
|
5178 |
tmp_tb = tstate->curexc_traceback;
|
|
5179 |
tstate->curexc_type = type;
|
|
5180 |
tstate->curexc_value = value;
|
|
5181 |
tstate->curexc_traceback = tb;
|
|
5182 |
Py_XDECREF(tmp_type);
|
|
5183 |
Py_XDECREF(tmp_value);
|
|
5184 |
Py_XDECREF(tmp_tb);
|
|
5185 |
}
|
|
5186 |
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
|
|
5187 |
*type = tstate->curexc_type;
|
|
5188 |
*value = tstate->curexc_value;
|
|
5189 |
*tb = tstate->curexc_traceback;
|
|
5190 |
tstate->curexc_type = 0;
|
|
5191 |
tstate->curexc_value = 0;
|
|
5192 |
tstate->curexc_traceback = 0;
|
|
5193 |
}
|
|
5194 |
#endif
|
|
5195 |
|
|
5196 |
/* CLineInTraceback */
|
|
5197 |
#ifndef CYTHON_CLINE_IN_TRACEBACK
|
|
5198 |
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
|
|
5199 |
PyObject *use_cline;
|
|
5200 |
PyObject *ptype, *pvalue, *ptraceback;
|
|
5201 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
5202 |
PyObject **cython_runtime_dict;
|
|
5203 |
#endif
|
|
5204 |
if (unlikely(!__pyx_cython_runtime)) {
|
|
5205 |
return c_line;
|
|
5206 |
}
|
|
5207 |
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
|
|
5208 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
5209 |
cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
|
|
5210 |
if (likely(cython_runtime_dict)) {
|
|
5211 |
__PYX_PY_DICT_LOOKUP_IF_MODIFIED(
|
|
5212 |
use_cline, *cython_runtime_dict,
|
|
5213 |
__Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
|
|
5214 |
} else
|
|
5215 |
#endif
|
|
5216 |
{
|
|
5217 |
PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
|
|
5218 |
if (use_cline_obj) {
|
|
5219 |
use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
|
|
5220 |
Py_DECREF(use_cline_obj);
|
|
5221 |
} else {
|
|
5222 |
PyErr_Clear();
|
|
5223 |
use_cline = NULL;
|
|
5224 |
}
|
|
5225 |
}
|
|
5226 |
if (!use_cline) {
|
|
5227 |
c_line = 0;
|
|
5228 |
PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
|
|
5229 |
}
|
|
5230 |
else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
|
|
5231 |
c_line = 0;
|
|
5232 |
}
|
|
5233 |
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
|
|
5234 |
return c_line;
|
|
5235 |
}
|
|
5236 |
#endif
|
|
5237 |
|
|
5238 |
/* CodeObjectCache */
|
|
5239 |
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
|
|
5240 |
int start = 0, mid = 0, end = count - 1;
|
|
5241 |
if (end >= 0 && code_line > entries[end].code_line) {
|
|
5242 |
return count;
|
|
5243 |
}
|
|
5244 |
while (start < end) {
|
|
5245 |
mid = start + (end - start) / 2;
|
|
5246 |
if (code_line < entries[mid].code_line) {
|
|
5247 |
end = mid;
|
|
5248 |
} else if (code_line > entries[mid].code_line) {
|
|
5249 |
start = mid + 1;
|
|
5250 |
} else {
|
|
5251 |
return mid;
|
|
5252 |
}
|
|
5253 |
}
|
|
5254 |
if (code_line <= entries[mid].code_line) {
|
|
5255 |
return mid;
|
|
5256 |
} else {
|
|
5257 |
return mid + 1;
|
|
5258 |
}
|
|
5259 |
}
|
|
5260 |
static PyCodeObject *__pyx_find_code_object(int code_line) {
|
|
5261 |
PyCodeObject* code_object;
|
|
5262 |
int pos;
|
|
5263 |
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
|
|
5264 |
return NULL;
|
|
5265 |
}
|
|
5266 |
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
|
|
5267 |
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
|
|
5268 |
return NULL;
|
|
5269 |
}
|
|
5270 |
code_object = __pyx_code_cache.entries[pos].code_object;
|
|
5271 |
Py_INCREF(code_object);
|
|
5272 |
return code_object;
|
|
5273 |
}
|
|
5274 |
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
|
|
5275 |
int pos, i;
|
|
5276 |
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
|
|
5277 |
if (unlikely(!code_line)) {
|
|
5278 |
return;
|
|
5279 |
}
|
|
5280 |
if (unlikely(!entries)) {
|
|
5281 |
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
|
|
5282 |
if (likely(entries)) {
|
|
5283 |
__pyx_code_cache.entries = entries;
|
|
5284 |
__pyx_code_cache.max_count = 64;
|
|
5285 |
__pyx_code_cache.count = 1;
|
|
5286 |
entries[0].code_line = code_line;
|
|
5287 |
entries[0].code_object = code_object;
|
|
5288 |
Py_INCREF(code_object);
|
|
5289 |
}
|
|
5290 |
return;
|
|
5291 |
}
|
|
5292 |
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
|
|
5293 |
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
|
|
5294 |
PyCodeObject* tmp = entries[pos].code_object;
|
|
5295 |
entries[pos].code_object = code_object;
|
|
5296 |
Py_DECREF(tmp);
|
|
5297 |
return;
|
|
5298 |
}
|
|
5299 |
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
|
|
5300 |
int new_max = __pyx_code_cache.max_count + 64;
|
|
5301 |
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
|
|
5302 |
__pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
|
|
5303 |
if (unlikely(!entries)) {
|
|
5304 |
return;
|
|
5305 |
}
|
|
5306 |
__pyx_code_cache.entries = entries;
|
|
5307 |
__pyx_code_cache.max_count = new_max;
|
|
5308 |
}
|
|
5309 |
for (i=__pyx_code_cache.count; i>pos; i--) {
|
|
5310 |
entries[i] = entries[i-1];
|
|
5311 |
}
|
|
5312 |
entries[pos].code_line = code_line;
|
|
5313 |
entries[pos].code_object = code_object;
|
|
5314 |
__pyx_code_cache.count++;
|
|
5315 |
Py_INCREF(code_object);
|
|
5316 |
}
|
|
5317 |
|
|
5318 |
/* AddTraceback */
|
|
5319 |
#include "compile.h"
|
|
5320 |
#include "frameobject.h"
|
|
5321 |
#include "traceback.h"
|
|
5322 |
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
|
|
5323 |
const char *funcname, int c_line,
|
|
5324 |
int py_line, const char *filename) {
|
|
5325 |
PyCodeObject *py_code = 0;
|
|
5326 |
PyObject *py_srcfile = 0;
|
|
5327 |
PyObject *py_funcname = 0;
|
|
5328 |
#if PY_MAJOR_VERSION < 3
|
|
5329 |
py_srcfile = PyString_FromString(filename);
|
|
5330 |
#else
|
|
5331 |
py_srcfile = PyUnicode_FromString(filename);
|
|
5332 |
#endif
|
|
5333 |
if (!py_srcfile) goto bad;
|
|
5334 |
if (c_line) {
|
|
5335 |
#if PY_MAJOR_VERSION < 3
|
|
5336 |
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
|
|
5337 |
#else
|
|
5338 |
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
|
|
5339 |
#endif
|
|
5340 |
}
|
|
5341 |
else {
|
|
5342 |
#if PY_MAJOR_VERSION < 3
|
|
5343 |
py_funcname = PyString_FromString(funcname);
|
|
5344 |
#else
|
|
5345 |
py_funcname = PyUnicode_FromString(funcname);
|
|
5346 |
#endif
|
|
5347 |
}
|
|
5348 |
if (!py_funcname) goto bad;
|
|
5349 |
py_code = __Pyx_PyCode_New(
|
|
5350 |
0,
|
|
5351 |
0,
|
|
5352 |
0,
|
|
5353 |
0,
|
|
5354 |
0,
|
|
5355 |
__pyx_empty_bytes, /*PyObject *code,*/
|
|
5356 |
__pyx_empty_tuple, /*PyObject *consts,*/
|
|
5357 |
__pyx_empty_tuple, /*PyObject *names,*/
|
|
5358 |
__pyx_empty_tuple, /*PyObject *varnames,*/
|
|
5359 |
__pyx_empty_tuple, /*PyObject *freevars,*/
|
|
5360 |
__pyx_empty_tuple, /*PyObject *cellvars,*/
|
|
5361 |
py_srcfile, /*PyObject *filename,*/
|
|
5362 |
py_funcname, /*PyObject *name,*/
|
|
5363 |
py_line,
|
|
5364 |
__pyx_empty_bytes /*PyObject *lnotab*/
|
|
5365 |
);
|
|
5366 |
Py_DECREF(py_srcfile);
|
|
5367 |
Py_DECREF(py_funcname);
|
|
5368 |
return py_code;
|
|
5369 |
bad:
|
|
5370 |
Py_XDECREF(py_srcfile);
|
|
5371 |
Py_XDECREF(py_funcname);
|
|
5372 |
return NULL;
|
|
5373 |
}
|
|
5374 |
static void __Pyx_AddTraceback(const char *funcname, int c_line,
|
|
5375 |
int py_line, const char *filename) {
|
|
5376 |
PyCodeObject *py_code = 0;
|
|
5377 |
PyFrameObject *py_frame = 0;
|
|
5378 |
PyThreadState *tstate = __Pyx_PyThreadState_Current;
|
|
5379 |
if (c_line) {
|
|
5380 |
c_line = __Pyx_CLineForTraceback(tstate, c_line);
|
|
5381 |
}
|
|
5382 |
py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
|
|
5383 |
if (!py_code) {
|
|
5384 |
py_code = __Pyx_CreateCodeObjectForTraceback(
|
|
5385 |
funcname, c_line, py_line, filename);
|
|
5386 |
if (!py_code) goto bad;
|
|
5387 |
__pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
|
|
5388 |
}
|
|
5389 |
py_frame = PyFrame_New(
|
|
5390 |
tstate, /*PyThreadState *tstate,*/
|
|
5391 |
py_code, /*PyCodeObject *code,*/
|
|
5392 |
__pyx_d, /*PyObject *globals,*/
|
|
5393 |
0 /*PyObject *locals*/
|
|
5394 |
);
|
|
5395 |
if (!py_frame) goto bad;
|
|
5396 |
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
|
|
5397 |
PyTraceBack_Here(py_frame);
|
|
5398 |
bad:
|
|
5399 |
Py_XDECREF(py_code);
|
|
5400 |
Py_XDECREF(py_frame);
|
|
5401 |
}
|
|
5402 |
|
|
5403 |
/* CIntFromPyVerify */
|
|
5404 |
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
|
|
5405 |
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
|
|
5406 |
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
|
|
5407 |
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
|
|
5408 |
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
|
|
5409 |
{\
|
|
5410 |
func_type value = func_value;\
|
|
5411 |
if (sizeof(target_type) < sizeof(func_type)) {\
|
|
5412 |
if (unlikely(value != (func_type) (target_type) value)) {\
|
|
5413 |
func_type zero = 0;\
|
|
5414 |
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
|
|
5415 |
return (target_type) -1;\
|
|
5416 |
if (is_unsigned && unlikely(value < zero))\
|
|
5417 |
goto raise_neg_overflow;\
|
|
5418 |
else\
|
|
5419 |
goto raise_overflow;\
|
|
5420 |
}\
|
|
5421 |
}\
|
|
5422 |
return (target_type) value;\
|
|
5423 |
}
|
|
5424 |
|
|
5425 |
/* CIntToPy */
|
|
5426 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) {
|
|
5427 |
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) ((unsigned PY_LONG_LONG) 0 - (unsigned PY_LONG_LONG) 1), const_zero = (unsigned PY_LONG_LONG) 0;
|
|
5428 |
const int is_unsigned = neg_one > const_zero;
|
|
5429 |
if (is_unsigned) {
|
|
5430 |
if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) {
|
|
5431 |
return PyInt_FromLong((long) value);
|
|
5432 |
} else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) {
|
|
5433 |
return PyLong_FromUnsignedLong((unsigned long) value);
|
|
5434 |
#ifdef HAVE_LONG_LONG
|
|
5435 |
} else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
|
|
5436 |
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
|
|
5437 |
#endif
|
|
5438 |
}
|
|
5439 |
} else {
|
|
5440 |
if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) {
|
|
5441 |
return PyInt_FromLong((long) value);
|
|
5442 |
#ifdef HAVE_LONG_LONG
|
|
5443 |
} else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
|
|
5444 |
return PyLong_FromLongLong((PY_LONG_LONG) value);
|
|
5445 |
#endif
|
|
5446 |
}
|
|
5447 |
}
|
|
5448 |
{
|
|
5449 |
int one = 1; int little = (int)*(unsigned char *)&one;
|
|
5450 |
unsigned char *bytes = (unsigned char *)&value;
|
|
5451 |
return _PyLong_FromByteArray(bytes, sizeof(unsigned PY_LONG_LONG),
|
|
5452 |
little, !is_unsigned);
|
|
5453 |
}
|
|
5454 |
}
|
|
5455 |
|
|
5456 |
/* CIntFromPy */
|
|
5457 |
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) {
|
|
5458 |
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) ((unsigned PY_LONG_LONG) 0 - (unsigned PY_LONG_LONG) 1), const_zero = (unsigned PY_LONG_LONG) 0;
|
|
5459 |
const int is_unsigned = neg_one > const_zero;
|
|
5460 |
#if PY_MAJOR_VERSION < 3
|
|
5461 |
if (likely(PyInt_Check(x))) {
|
|
5462 |
if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) {
|
|
5463 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, PyInt_AS_LONG(x))
|
|
5464 |
} else {
|
|
5465 |
long val = PyInt_AS_LONG(x);
|
|
5466 |
if (is_unsigned && unlikely(val < 0)) {
|
|
5467 |
goto raise_neg_overflow;
|
|
5468 |
}
|
|
5469 |
return (unsigned PY_LONG_LONG) val;
|
|
5470 |
}
|
|
5471 |
} else
|
|
5472 |
#endif
|
|
5473 |
if (likely(PyLong_Check(x))) {
|
|
5474 |
if (is_unsigned) {
|
|
5475 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
5476 |
const digit* digits = ((PyLongObject*)x)->ob_digit;
|
|
5477 |
switch (Py_SIZE(x)) {
|
|
5478 |
case 0: return (unsigned PY_LONG_LONG) 0;
|
|
5479 |
case 1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, digit, digits[0])
|
|
5480 |
case 2:
|
|
5481 |
if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
|
|
5482 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5483 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5484 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
|
|
5485 |
return (unsigned PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
5486 |
}
|
|
5487 |
}
|
|
5488 |
break;
|
|
5489 |
case 3:
|
|
5490 |
if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
|
|
5491 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5492 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5493 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
|
|
5494 |
return (unsigned PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
5495 |
}
|
|
5496 |
}
|
|
5497 |
break;
|
|
5498 |
case 4:
|
|
5499 |
if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
|
|
5500 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5501 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5502 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
|
|
5503 |
return (unsigned PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
|
|
5504 |
}
|
|
5505 |
}
|
|
5506 |
break;
|
|
5507 |
}
|
|
5508 |
#endif
|
|
5509 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
5510 |
if (unlikely(Py_SIZE(x) < 0)) {
|
|
5511 |
goto raise_neg_overflow;
|
|
5512 |
}
|
|
5513 |
#else
|
|
5514 |
{
|
|
5515 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
|
|
5516 |
if (unlikely(result < 0))
|
|
5517 |
return (unsigned PY_LONG_LONG) -1;
|
|
5518 |
if (unlikely(result == 1))
|
|
5519 |
goto raise_neg_overflow;
|
|
5520 |
}
|
|
5521 |
#endif
|
|
5522 |
if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned long)) {
|
|
5523 |
__PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
|
|
5524 |
#ifdef HAVE_LONG_LONG
|
|
5525 |
} else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
|
|
5526 |
__PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
|
|
5527 |
#endif
|
|
5528 |
}
|
|
5529 |
} else {
|
|
5530 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
5531 |
const digit* digits = ((PyLongObject*)x)->ob_digit;
|
|
5532 |
switch (Py_SIZE(x)) {
|
|
5533 |
case 0: return (unsigned PY_LONG_LONG) 0;
|
|
5534 |
case -1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
|
|
5535 |
case 1: __PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, digit, +digits[0])
|
|
5536 |
case -2:
|
|
5537 |
if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
|
|
5538 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5539 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5540 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
|
|
5541 |
return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
|
|
5542 |
}
|
|
5543 |
}
|
|
5544 |
break;
|
|
5545 |
case 2:
|
|
5546 |
if (8 * sizeof(unsigned PY_LONG_LONG) > 1 * PyLong_SHIFT) {
|
|
5547 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5548 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5549 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
|
|
5550 |
return (unsigned PY_LONG_LONG) ((((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
|
|
5551 |
}
|
|
5552 |
}
|
|
5553 |
break;
|
|
5554 |
case -3:
|
|
5555 |
if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
|
|
5556 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5557 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5558 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
|
|
5559 |
return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
|
|
5560 |
}
|
|
5561 |
}
|
|
5562 |
break;
|
|
5563 |
case 3:
|
|
5564 |
if (8 * sizeof(unsigned PY_LONG_LONG) > 2 * PyLong_SHIFT) {
|
|
5565 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5566 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5567 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
|
|
5568 |
return (unsigned PY_LONG_LONG) ((((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
|
|
5569 |
}
|
|
5570 |
}
|
|
5571 |
break;
|
|
5572 |
case -4:
|
|
5573 |
if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
|
|
5574 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5575 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5576 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
|
|
5577 |
return (unsigned PY_LONG_LONG) (((unsigned PY_LONG_LONG)-1)*(((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
|
|
5578 |
}
|
|
5579 |
}
|
|
5580 |
break;
|
|
5581 |
case 4:
|
|
5582 |
if (8 * sizeof(unsigned PY_LONG_LONG) > 3 * PyLong_SHIFT) {
|
|
5583 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5584 |
__PYX_VERIFY_RETURN_INT(unsigned PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5585 |
} else if (8 * sizeof(unsigned PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
|
|
5586 |
return (unsigned PY_LONG_LONG) ((((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])));
|
|
5587 |
}
|
|
5588 |
}
|
|
5589 |
break;
|
|
5590 |
}
|
|
5591 |
#endif
|
|
5592 |
if (sizeof(unsigned PY_LONG_LONG) <= sizeof(long)) {
|
|
5593 |
__PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, long, PyLong_AsLong(x))
|
|
5594 |
#ifdef HAVE_LONG_LONG
|
|
5595 |
} else if (sizeof(unsigned PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
|
|
5596 |
__PYX_VERIFY_RETURN_INT_EXC(unsigned PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
|
|
5597 |
#endif
|
|
5598 |
}
|
|
5599 |
}
|
|
5600 |
{
|
|
5601 |
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
|
|
5602 |
PyErr_SetString(PyExc_RuntimeError,
|
|
5603 |
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
|
|
5604 |
#else
|
|
5605 |
unsigned PY_LONG_LONG val;
|
|
5606 |
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
|
|
5607 |
#if PY_MAJOR_VERSION < 3
|
|
5608 |
if (likely(v) && !PyLong_Check(v)) {
|
|
5609 |
PyObject *tmp = v;
|
|
5610 |
v = PyNumber_Long(tmp);
|
|
5611 |
Py_DECREF(tmp);
|
|
5612 |
}
|
|
5613 |
#endif
|
|
5614 |
if (likely(v)) {
|
|
5615 |
int one = 1; int is_little = (int)*(unsigned char *)&one;
|
|
5616 |
unsigned char *bytes = (unsigned char *)&val;
|
|
5617 |
int ret = _PyLong_AsByteArray((PyLongObject *)v,
|
|
5618 |
bytes, sizeof(val),
|
|
5619 |
is_little, !is_unsigned);
|
|
5620 |
Py_DECREF(v);
|
|
5621 |
if (likely(!ret))
|
|
5622 |
return val;
|
|
5623 |
}
|
|
5624 |
#endif
|
|
5625 |
return (unsigned PY_LONG_LONG) -1;
|
|
5626 |
}
|
|
5627 |
} else {
|
|
5628 |
unsigned PY_LONG_LONG val;
|
|
5629 |
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
|
|
5630 |
if (!tmp) return (unsigned PY_LONG_LONG) -1;
|
|
5631 |
val = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(tmp);
|
|
5632 |
Py_DECREF(tmp);
|
|
5633 |
return val;
|
|
5634 |
}
|
|
5635 |
raise_overflow:
|
|
5636 |
PyErr_SetString(PyExc_OverflowError,
|
|
5637 |
"value too large to convert to unsigned PY_LONG_LONG");
|
|
5638 |
return (unsigned PY_LONG_LONG) -1;
|
|
5639 |
raise_neg_overflow:
|
|
5640 |
PyErr_SetString(PyExc_OverflowError,
|
|
5641 |
"can't convert negative value to unsigned PY_LONG_LONG");
|
|
5642 |
return (unsigned PY_LONG_LONG) -1;
|
|
5643 |
}
|
|
5644 |
|
|
5645 |
/* CIntToPy */
|
|
5646 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
|
|
5647 |
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
|
|
5648 |
const int is_unsigned = neg_one > const_zero;
|
|
5649 |
if (is_unsigned) {
|
|
5650 |
if (sizeof(long) < sizeof(long)) {
|
|
5651 |
return PyInt_FromLong((long) value);
|
|
5652 |
} else if (sizeof(long) <= sizeof(unsigned long)) {
|
|
5653 |
return PyLong_FromUnsignedLong((unsigned long) value);
|
|
5654 |
#ifdef HAVE_LONG_LONG
|
|
5655 |
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
|
|
5656 |
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
|
|
5657 |
#endif
|
|
5658 |
}
|
|
5659 |
} else {
|
|
5660 |
if (sizeof(long) <= sizeof(long)) {
|
|
5661 |
return PyInt_FromLong((long) value);
|
|
5662 |
#ifdef HAVE_LONG_LONG
|
|
5663 |
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
|
|
5664 |
return PyLong_FromLongLong((PY_LONG_LONG) value);
|
|
5665 |
#endif
|
|
5666 |
}
|
|
5667 |
}
|
|
5668 |
{
|
|
5669 |
int one = 1; int little = (int)*(unsigned char *)&one;
|
|
5670 |
unsigned char *bytes = (unsigned char *)&value;
|
|
5671 |
return _PyLong_FromByteArray(bytes, sizeof(long),
|
|
5672 |
little, !is_unsigned);
|
|
5673 |
}
|
|
5674 |
}
|
|
5675 |
|
|
5676 |
/* CIntFromPy */
|
|
5677 |
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
|
|
5678 |
const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
|
|
5679 |
const int is_unsigned = neg_one > const_zero;
|
|
5680 |
#if PY_MAJOR_VERSION < 3
|
|
5681 |
if (likely(PyInt_Check(x))) {
|
|
5682 |
if (sizeof(long) < sizeof(long)) {
|
|
5683 |
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
|
|
5684 |
} else {
|
|
5685 |
long val = PyInt_AS_LONG(x);
|
|
5686 |
if (is_unsigned && unlikely(val < 0)) {
|
|
5687 |
goto raise_neg_overflow;
|
|
5688 |
}
|
|
5689 |
return (long) val;
|
|
5690 |
}
|
|
5691 |
} else
|
|
5692 |
#endif
|
|
5693 |
if (likely(PyLong_Check(x))) {
|
|
5694 |
if (is_unsigned) {
|
|
5695 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
5696 |
const digit* digits = ((PyLongObject*)x)->ob_digit;
|
|
5697 |
switch (Py_SIZE(x)) {
|
|
5698 |
case 0: return (long) 0;
|
|
5699 |
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
|
|
5700 |
case 2:
|
|
5701 |
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
|
|
5702 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5703 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5704 |
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
|
|
5705 |
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
|
|
5706 |
}
|
|
5707 |
}
|
|
5708 |
break;
|
|
5709 |
case 3:
|
|
5710 |
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
|
|
5711 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5712 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5713 |
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
|
|
5714 |
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
|
|
5715 |
}
|
|
5716 |
}
|
|
5717 |
break;
|
|
5718 |
case 4:
|
|
5719 |
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
|
|
5720 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5721 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5722 |
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
|
|
5723 |
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
|
|
5724 |
}
|
|
5725 |
}
|
|
5726 |
break;
|
|
5727 |
}
|
|
5728 |
#endif
|
|
5729 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
5730 |
if (unlikely(Py_SIZE(x) < 0)) {
|
|
5731 |
goto raise_neg_overflow;
|
|
5732 |
}
|
|
5733 |
#else
|
|
5734 |
{
|
|
5735 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
|
|
5736 |
if (unlikely(result < 0))
|
|
5737 |
return (long) -1;
|
|
5738 |
if (unlikely(result == 1))
|
|
5739 |
goto raise_neg_overflow;
|
|
5740 |
}
|
|
5741 |
#endif
|
|
5742 |
if (sizeof(long) <= sizeof(unsigned long)) {
|
|
5743 |
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
|
|
5744 |
#ifdef HAVE_LONG_LONG
|
|
5745 |
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
|
|
5746 |
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
|
|
5747 |
#endif
|
|
5748 |
}
|
|
5749 |
} else {
|
|
5750 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
5751 |
const digit* digits = ((PyLongObject*)x)->ob_digit;
|
|
5752 |
switch (Py_SIZE(x)) {
|
|
5753 |
case 0: return (long) 0;
|
|
5754 |
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
|
|
5755 |
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
|
|
5756 |
case -2:
|
|
5757 |
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
|
|
5758 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5759 |
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5760 |
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
|
|
5761 |
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
|
|
5762 |
}
|
|
5763 |
}
|
|
5764 |
break;
|
|
5765 |
case 2:
|
|
5766 |
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
|
|
5767 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5768 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5769 |
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
|
|
5770 |
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
|
|
5771 |
}
|
|
5772 |
}
|
|
5773 |
break;
|
|
5774 |
case -3:
|
|
5775 |
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
|
|
5776 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5777 |
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5778 |
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
|
|
5779 |
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
|
|
5780 |
}
|
|
5781 |
}
|
|
5782 |
break;
|
|
5783 |
case 3:
|
|
5784 |
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
|
|
5785 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5786 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5787 |
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
|
|
5788 |
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
|
|
5789 |
}
|
|
5790 |
}
|
|
5791 |
break;
|
|
5792 |
case -4:
|
|
5793 |
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
|
|
5794 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5795 |
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5796 |
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
|
|
5797 |
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
|
|
5798 |
}
|
|
5799 |
}
|
|
5800 |
break;
|
|
5801 |
case 4:
|
|
5802 |
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
|
|
5803 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5804 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5805 |
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
|
|
5806 |
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
|
|
5807 |
}
|
|
5808 |
}
|
|
5809 |
break;
|
|
5810 |
}
|
|
5811 |
#endif
|
|
5812 |
if (sizeof(long) <= sizeof(long)) {
|
|
5813 |
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
|
|
5814 |
#ifdef HAVE_LONG_LONG
|
|
5815 |
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
|
|
5816 |
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
|
|
5817 |
#endif
|
|
5818 |
}
|
|
5819 |
}
|
|
5820 |
{
|
|
5821 |
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
|
|
5822 |
PyErr_SetString(PyExc_RuntimeError,
|
|
5823 |
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
|
|
5824 |
#else
|
|
5825 |
long val;
|
|
5826 |
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
|
|
5827 |
#if PY_MAJOR_VERSION < 3
|
|
5828 |
if (likely(v) && !PyLong_Check(v)) {
|
|
5829 |
PyObject *tmp = v;
|
|
5830 |
v = PyNumber_Long(tmp);
|
|
5831 |
Py_DECREF(tmp);
|
|
5832 |
}
|
|
5833 |
#endif
|
|
5834 |
if (likely(v)) {
|
|
5835 |
int one = 1; int is_little = (int)*(unsigned char *)&one;
|
|
5836 |
unsigned char *bytes = (unsigned char *)&val;
|
|
5837 |
int ret = _PyLong_AsByteArray((PyLongObject *)v,
|
|
5838 |
bytes, sizeof(val),
|
|
5839 |
is_little, !is_unsigned);
|
|
5840 |
Py_DECREF(v);
|
|
5841 |
if (likely(!ret))
|
|
5842 |
return val;
|
|
5843 |
}
|
|
5844 |
#endif
|
|
5845 |
return (long) -1;
|
|
5846 |
}
|
|
5847 |
} else {
|
|
5848 |
long val;
|
|
5849 |
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
|
|
5850 |
if (!tmp) return (long) -1;
|
|
5851 |
val = __Pyx_PyInt_As_long(tmp);
|
|
5852 |
Py_DECREF(tmp);
|
|
5853 |
return val;
|
|
5854 |
}
|
|
5855 |
raise_overflow:
|
|
5856 |
PyErr_SetString(PyExc_OverflowError,
|
|
5857 |
"value too large to convert to long");
|
|
5858 |
return (long) -1;
|
|
5859 |
raise_neg_overflow:
|
|
5860 |
PyErr_SetString(PyExc_OverflowError,
|
|
5861 |
"can't convert negative value to long");
|
|
5862 |
return (long) -1;
|
|
5863 |
}
|
|
5864 |
|
|
5865 |
/* CIntFromPy */
|
|
5866 |
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
|
|
5867 |
const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
|
|
5868 |
const int is_unsigned = neg_one > const_zero;
|
|
5869 |
#if PY_MAJOR_VERSION < 3
|
|
5870 |
if (likely(PyInt_Check(x))) {
|
|
5871 |
if (sizeof(int) < sizeof(long)) {
|
|
5872 |
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
|
|
5873 |
} else {
|
|
5874 |
long val = PyInt_AS_LONG(x);
|
|
5875 |
if (is_unsigned && unlikely(val < 0)) {
|
|
5876 |
goto raise_neg_overflow;
|
|
5877 |
}
|
|
5878 |
return (int) val;
|
|
5879 |
}
|
|
5880 |
} else
|
|
5881 |
#endif
|
|
5882 |
if (likely(PyLong_Check(x))) {
|
|
5883 |
if (is_unsigned) {
|
|
5884 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
5885 |
const digit* digits = ((PyLongObject*)x)->ob_digit;
|
|
5886 |
switch (Py_SIZE(x)) {
|
|
5887 |
case 0: return (int) 0;
|
|
5888 |
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
|
|
5889 |
case 2:
|
|
5890 |
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
|
|
5891 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5892 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5893 |
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
|
|
5894 |
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
|
|
5895 |
}
|
|
5896 |
}
|
|
5897 |
break;
|
|
5898 |
case 3:
|
|
5899 |
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
|
|
5900 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5901 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5902 |
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
|
|
5903 |
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
|
|
5904 |
}
|
|
5905 |
}
|
|
5906 |
break;
|
|
5907 |
case 4:
|
|
5908 |
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
|
|
5909 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5910 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5911 |
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
|
|
5912 |
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
|
|
5913 |
}
|
|
5914 |
}
|
|
5915 |
break;
|
|
5916 |
}
|
|
5917 |
#endif
|
|
5918 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
5919 |
if (unlikely(Py_SIZE(x) < 0)) {
|
|
5920 |
goto raise_neg_overflow;
|
|
5921 |
}
|
|
5922 |
#else
|
|
5923 |
{
|
|
5924 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
|
|
5925 |
if (unlikely(result < 0))
|
|
5926 |
return (int) -1;
|
|
5927 |
if (unlikely(result == 1))
|
|
5928 |
goto raise_neg_overflow;
|
|
5929 |
}
|
|
5930 |
#endif
|
|
5931 |
if (sizeof(int) <= sizeof(unsigned long)) {
|
|
5932 |
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
|
|
5933 |
#ifdef HAVE_LONG_LONG
|
|
5934 |
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
|
|
5935 |
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
|
|
5936 |
#endif
|
|
5937 |
}
|
|
5938 |
} else {
|
|
5939 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
5940 |
const digit* digits = ((PyLongObject*)x)->ob_digit;
|
|
5941 |
switch (Py_SIZE(x)) {
|
|
5942 |
case 0: return (int) 0;
|
|
5943 |
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
|
|
5944 |
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
|
|
5945 |
case -2:
|
|
5946 |
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
|
|
5947 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5948 |
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5949 |
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
|
|
5950 |
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
|
|
5951 |
}
|
|
5952 |
}
|
|
5953 |
break;
|
|
5954 |
case 2:
|
|
5955 |
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
|
|
5956 |
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
|
|
5957 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5958 |
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
|
|
5959 |
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
|
|
5960 |
}
|
|
5961 |
}
|
|
5962 |
break;
|
|
5963 |
case -3:
|
|
5964 |
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
|
|
5965 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5966 |
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5967 |
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
|
|
5968 |
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
|
|
5969 |
}
|
|
5970 |
}
|
|
5971 |
break;
|
|
5972 |
case 3:
|
|
5973 |
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
|
|
5974 |
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
|
|
5975 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5976 |
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
|
|
5977 |
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
|
|
5978 |
}
|
|
5979 |
}
|
|
5980 |
break;
|
|
5981 |
case -4:
|
|
5982 |
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
|
|
5983 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5984 |
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5985 |
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
|
|
5986 |
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
|
|
5987 |
}
|
|
5988 |
}
|
|
5989 |
break;
|
|
5990 |
case 4:
|
|
5991 |
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
|
|
5992 |
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
|
|
5993 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
|
|
5994 |
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
|
|
5995 |
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
|
|
5996 |
}
|
|
5997 |
}
|
|
5998 |
break;
|
|
5999 |
}
|
|
6000 |
#endif
|
|
6001 |
if (sizeof(int) <= sizeof(long)) {
|
|
6002 |
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
|
|
6003 |
#ifdef HAVE_LONG_LONG
|
|
6004 |
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
|
|
6005 |
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
|
|
6006 |
#endif
|
|
6007 |
}
|
|
6008 |
}
|
|
6009 |
{
|
|
6010 |
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
|
|
6011 |
PyErr_SetString(PyExc_RuntimeError,
|
|
6012 |
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
|
|
6013 |
#else
|
|
6014 |
int val;
|
|
6015 |
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
|
|
6016 |
#if PY_MAJOR_VERSION < 3
|
|
6017 |
if (likely(v) && !PyLong_Check(v)) {
|
|
6018 |
PyObject *tmp = v;
|
|
6019 |
v = PyNumber_Long(tmp);
|
|
6020 |
Py_DECREF(tmp);
|
|
6021 |
}
|
|
6022 |
#endif
|
|
6023 |
if (likely(v)) {
|
|
6024 |
int one = 1; int is_little = (int)*(unsigned char *)&one;
|
|
6025 |
unsigned char *bytes = (unsigned char *)&val;
|
|
6026 |
int ret = _PyLong_AsByteArray((PyLongObject *)v,
|
|
6027 |
bytes, sizeof(val),
|
|
6028 |
is_little, !is_unsigned);
|
|
6029 |
Py_DECREF(v);
|
|
6030 |
if (likely(!ret))
|
|
6031 |
return val;
|
|
6032 |
}
|
|
6033 |
#endif
|
|
6034 |
return (int) -1;
|
|
6035 |
}
|
|
6036 |
} else {
|
|
6037 |
int val;
|
|
6038 |
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
|
|
6039 |
if (!tmp) return (int) -1;
|
|
6040 |
val = __Pyx_PyInt_As_int(tmp);
|
|
6041 |
Py_DECREF(tmp);
|
|
6042 |
return val;
|
|
6043 |
}
|
|
6044 |
raise_overflow:
|
|
6045 |
PyErr_SetString(PyExc_OverflowError,
|
|
6046 |
"value too large to convert to int");
|
|
6047 |
return (int) -1;
|
|
6048 |
raise_neg_overflow:
|
|
6049 |
PyErr_SetString(PyExc_OverflowError,
|
|
6050 |
"can't convert negative value to int");
|
|
6051 |
return (int) -1;
|
|
6052 |
}
|
|
6053 |
|
|
6054 |
/* FastTypeChecks */
|
|
6055 |
#if CYTHON_COMPILING_IN_CPYTHON
|
|
6056 |
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
|
|
6057 |
while (a) {
|
|
6058 |
a = a->tp_base;
|
|
6059 |
if (a == b)
|
|
6060 |
return 1;
|
|
6061 |
}
|
|
6062 |
return b == &PyBaseObject_Type;
|
|
6063 |
}
|
|
6064 |
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
|
|
6065 |
PyObject *mro;
|
|
6066 |
if (a == b) return 1;
|
|
6067 |
mro = a->tp_mro;
|
|
6068 |
if (likely(mro)) {
|
|
6069 |
Py_ssize_t i, n;
|
|
6070 |
n = PyTuple_GET_SIZE(mro);
|
|
6071 |
for (i = 0; i < n; i++) {
|
|
6072 |
if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
|
|
6073 |
return 1;
|
|
6074 |
}
|
|
6075 |
return 0;
|
|
6076 |
}
|
|
6077 |
return __Pyx_InBases(a, b);
|
|
6078 |
}
|
|
6079 |
#if PY_MAJOR_VERSION == 2
|
|
6080 |
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
|
|
6081 |
PyObject *exception, *value, *tb;
|
|
6082 |
int res;
|
|
6083 |
__Pyx_PyThreadState_declare
|
|
6084 |
__Pyx_PyThreadState_assign
|
|
6085 |
__Pyx_ErrFetch(&exception, &value, &tb);
|
|
6086 |
res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
|
|
6087 |
if (unlikely(res == -1)) {
|
|
6088 |
PyErr_WriteUnraisable(err);
|
|
6089 |
res = 0;
|
|
6090 |
}
|
|
6091 |
if (!res) {
|
|
6092 |
res = PyObject_IsSubclass(err, exc_type2);
|
|
6093 |
if (unlikely(res == -1)) {
|
|
6094 |
PyErr_WriteUnraisable(err);
|
|
6095 |
res = 0;
|
|
6096 |
}
|
|
6097 |
}
|
|
6098 |
__Pyx_ErrRestore(exception, value, tb);
|
|
6099 |
return res;
|
|
6100 |
}
|
|
6101 |
#else
|
|
6102 |
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
|
|
6103 |
int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
|
|
6104 |
if (!res) {
|
|
6105 |
res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
|
|
6106 |
}
|
|
6107 |
return res;
|
|
6108 |
}
|
|
6109 |
#endif
|
|
6110 |
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
|
|
6111 |
Py_ssize_t i, n;
|
|
6112 |
assert(PyExceptionClass_Check(exc_type));
|
|
6113 |
n = PyTuple_GET_SIZE(tuple);
|
|
6114 |
#if PY_MAJOR_VERSION >= 3
|
|
6115 |
for (i=0; i<n; i++) {
|
|
6116 |
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
|
|
6117 |
}
|
|
6118 |
#endif
|
|
6119 |
for (i=0; i<n; i++) {
|
|
6120 |
PyObject *t = PyTuple_GET_ITEM(tuple, i);
|
|
6121 |
#if PY_MAJOR_VERSION < 3
|
|
6122 |
if (likely(exc_type == t)) return 1;
|
|
6123 |
#endif
|
|
6124 |
if (likely(PyExceptionClass_Check(t))) {
|
|
6125 |
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
|
|
6126 |
} else {
|
|
6127 |
}
|
|
6128 |
}
|
|
6129 |
return 0;
|
|
6130 |
}
|
|
6131 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
|
|
6132 |
if (likely(err == exc_type)) return 1;
|
|
6133 |
if (likely(PyExceptionClass_Check(err))) {
|
|
6134 |
if (likely(PyExceptionClass_Check(exc_type))) {
|
|
6135 |
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
|
|
6136 |
} else if (likely(PyTuple_Check(exc_type))) {
|
|
6137 |
return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
|
|
6138 |
} else {
|
|
6139 |
}
|
|
6140 |
}
|
|
6141 |
return PyErr_GivenExceptionMatches(err, exc_type);
|
|
6142 |
}
|
|
6143 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
|
|
6144 |
assert(PyExceptionClass_Check(exc_type1));
|
|
6145 |
assert(PyExceptionClass_Check(exc_type2));
|
|
6146 |
if (likely(err == exc_type1 || err == exc_type2)) return 1;
|
|
6147 |
if (likely(PyExceptionClass_Check(err))) {
|
|
6148 |
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
|
|
6149 |
}
|
|
6150 |
return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
|
|
6151 |
}
|
|
6152 |
#endif
|
|
6153 |
|
|
6154 |
/* CheckBinaryVersion */
|
|
6155 |
static int __Pyx_check_binary_version(void) {
|
|
6156 |
char ctversion[4], rtversion[4];
|
|
6157 |
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
|
|
6158 |
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
|
|
6159 |
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
|
|
6160 |
char message[200];
|
|
6161 |
PyOS_snprintf(message, sizeof(message),
|
|
6162 |
"compiletime version %s of module '%.100s' "
|
|
6163 |
"does not match runtime version %s",
|
|
6164 |
ctversion, __Pyx_MODULE_NAME, rtversion);
|
|
6165 |
return PyErr_WarnEx(NULL, message, 1);
|
|
6166 |
}
|
|
6167 |
return 0;
|
|
6168 |
}
|
|
6169 |
|
|
6170 |
/* InitStrings */
|
|
6171 |
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
|
|
6172 |
while (t->p) {
|
|
6173 |
#if PY_MAJOR_VERSION < 3
|
|
6174 |
if (t->is_unicode) {
|
|
6175 |
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
|
|
6176 |
} else if (t->intern) {
|
|
6177 |
*t->p = PyString_InternFromString(t->s);
|
|
6178 |
} else {
|
|
6179 |
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
|
|
6180 |
}
|
|
6181 |
#else
|
|
6182 |
if (t->is_unicode | t->is_str) {
|
|
6183 |
if (t->intern) {
|
|
6184 |
*t->p = PyUnicode_InternFromString(t->s);
|
|
6185 |
} else if (t->encoding) {
|
|
6186 |
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
|
|
6187 |
} else {
|
|
6188 |
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
|
|
6189 |
}
|
|
6190 |
} else {
|
|
6191 |
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
|
|
6192 |
}
|
|
6193 |
#endif
|
|
6194 |
if (!*t->p)
|
|
6195 |
return -1;
|
|
6196 |
if (PyObject_Hash(*t->p) == -1)
|
|
6197 |
return -1;
|
|
6198 |
++t;
|
|
6199 |
}
|
|
6200 |
return 0;
|
|
6201 |
}
|
|
6202 |
|
|
6203 |
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
|
|
6204 |
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
|
|
6205 |
}
|
|
6206 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
|
|
6207 |
Py_ssize_t ignore;
|
|
6208 |
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
|
|
6209 |
}
|
|
6210 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
|
|
6211 |
#if !CYTHON_PEP393_ENABLED
|
|
6212 |
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
|
|
6213 |
char* defenc_c;
|
|
6214 |
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
|
|
6215 |
if (!defenc) return NULL;
|
|
6216 |
defenc_c = PyBytes_AS_STRING(defenc);
|
|
6217 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
|
|
6218 |
{
|
|
6219 |
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
|
|
6220 |
char* c;
|
|
6221 |
for (c = defenc_c; c < end; c++) {
|
|
6222 |
if ((unsigned char) (*c) >= 128) {
|
|
6223 |
PyUnicode_AsASCIIString(o);
|
|
6224 |
return NULL;
|
|
6225 |
}
|
|
6226 |
}
|
|
6227 |
}
|
|
6228 |
#endif
|
|
6229 |
*length = PyBytes_GET_SIZE(defenc);
|
|
6230 |
return defenc_c;
|
|
6231 |
}
|
|
6232 |
#else
|
|
6233 |
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
|
|
6234 |
if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
|
|
6235 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
|
|
6236 |
if (likely(PyUnicode_IS_ASCII(o))) {
|
|
6237 |
*length = PyUnicode_GET_LENGTH(o);
|
|
6238 |
return PyUnicode_AsUTF8(o);
|
|
6239 |
} else {
|
|
6240 |
PyUnicode_AsASCIIString(o);
|
|
6241 |
return NULL;
|
|
6242 |
}
|
|
6243 |
#else
|
|
6244 |
return PyUnicode_AsUTF8AndSize(o, length);
|
|
6245 |
#endif
|
|
6246 |
}
|
|
6247 |
#endif
|
|
6248 |
#endif
|
|
6249 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
|
|
6250 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
|
|
6251 |
if (
|
|
6252 |
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
|
|
6253 |
__Pyx_sys_getdefaultencoding_not_ascii &&
|
|
6254 |
#endif
|
|
6255 |
PyUnicode_Check(o)) {
|
|
6256 |
return __Pyx_PyUnicode_AsStringAndSize(o, length);
|
|
6257 |
} else
|
|
6258 |
#endif
|
|
6259 |
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
|
|
6260 |
if (PyByteArray_Check(o)) {
|
|
6261 |
*length = PyByteArray_GET_SIZE(o);
|
|
6262 |
return PyByteArray_AS_STRING(o);
|
|
6263 |
} else
|
|
6264 |
#endif
|
|
6265 |
{
|
|
6266 |
char* result;
|
|
6267 |
int r = PyBytes_AsStringAndSize(o, &result, length);
|
|
6268 |
if (unlikely(r < 0)) {
|
|
6269 |
return NULL;
|
|
6270 |
} else {
|
|
6271 |
return result;
|
|
6272 |
}
|
|
6273 |
}
|
|
6274 |
}
|
|
6275 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
|
|
6276 |
int is_true = x == Py_True;
|
|
6277 |
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
|
|
6278 |
else return PyObject_IsTrue(x);
|
|
6279 |
}
|
|
6280 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
|
|
6281 |
int retval;
|
|
6282 |
if (unlikely(!x)) return -1;
|
|
6283 |
retval = __Pyx_PyObject_IsTrue(x);
|
|
6284 |
Py_DECREF(x);
|
|
6285 |
return retval;
|
|
6286 |
}
|
|
6287 |
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
|
|
6288 |
#if PY_MAJOR_VERSION >= 3
|
|
6289 |
if (PyLong_Check(result)) {
|
|
6290 |
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
|
|
6291 |
"__int__ returned non-int (type %.200s). "
|
|
6292 |
"The ability to return an instance of a strict subclass of int "
|
|
6293 |
"is deprecated, and may be removed in a future version of Python.",
|
|
6294 |
Py_TYPE(result)->tp_name)) {
|
|
6295 |
Py_DECREF(result);
|
|
6296 |
return NULL;
|
|
6297 |
}
|
|
6298 |
return result;
|
|
6299 |
}
|
|
6300 |
#endif
|
|
6301 |
PyErr_Format(PyExc_TypeError,
|
|
6302 |
"__%.4s__ returned non-%.4s (type %.200s)",
|
|
6303 |
type_name, type_name, Py_TYPE(result)->tp_name);
|
|
6304 |
Py_DECREF(result);
|
|
6305 |
return NULL;
|
|
6306 |
}
|
|
6307 |
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
|
|
6308 |
#if CYTHON_USE_TYPE_SLOTS
|
|
6309 |
PyNumberMethods *m;
|
|
6310 |
#endif
|
|
6311 |
const char *name = NULL;
|
|
6312 |
PyObject *res = NULL;
|
|
6313 |
#if PY_MAJOR_VERSION < 3
|
|
6314 |
if (likely(PyInt_Check(x) || PyLong_Check(x)))
|
|
6315 |
#else
|
|
6316 |
if (likely(PyLong_Check(x)))
|
|
6317 |
#endif
|
|
6318 |
return __Pyx_NewRef(x);
|
|
6319 |
#if CYTHON_USE_TYPE_SLOTS
|
|
6320 |
m = Py_TYPE(x)->tp_as_number;
|
|
6321 |
#if PY_MAJOR_VERSION < 3
|
|
6322 |
if (m && m->nb_int) {
|
|
6323 |
name = "int";
|
|
6324 |
res = m->nb_int(x);
|
|
6325 |
}
|
|
6326 |
else if (m && m->nb_long) {
|
|
6327 |
name = "long";
|
|
6328 |
res = m->nb_long(x);
|
|
6329 |
}
|
|
6330 |
#else
|
|
6331 |
if (likely(m && m->nb_int)) {
|
|
6332 |
name = "int";
|
|
6333 |
res = m->nb_int(x);
|
|
6334 |
}
|
|
6335 |
#endif
|
|
6336 |
#else
|
|
6337 |
if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
|
|
6338 |
res = PyNumber_Int(x);
|
|
6339 |
}
|
|
6340 |
#endif
|
|
6341 |
if (likely(res)) {
|
|
6342 |
#if PY_MAJOR_VERSION < 3
|
|
6343 |
if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
|
|
6344 |
#else
|
|
6345 |
if (unlikely(!PyLong_CheckExact(res))) {
|
|
6346 |
#endif
|
|
6347 |
return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
|
|
6348 |
}
|
|
6349 |
}
|
|
6350 |
else if (!PyErr_Occurred()) {
|
|
6351 |
PyErr_SetString(PyExc_TypeError,
|
|
6352 |
"an integer is required");
|
|
6353 |
}
|
|
6354 |
return res;
|
|
6355 |
}
|
|
6356 |
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
|
|
6357 |
Py_ssize_t ival;
|
|
6358 |
PyObject *x;
|
|
6359 |
#if PY_MAJOR_VERSION < 3
|
|
6360 |
if (likely(PyInt_CheckExact(b))) {
|
|
6361 |
if (sizeof(Py_ssize_t) >= sizeof(long))
|
|
6362 |
return PyInt_AS_LONG(b);
|
|
6363 |
else
|
|
6364 |
return PyInt_AsSsize_t(b);
|
|
6365 |
}
|
|
6366 |
#endif
|
|
6367 |
if (likely(PyLong_CheckExact(b))) {
|
|
6368 |
#if CYTHON_USE_PYLONG_INTERNALS
|
|
6369 |
const digit* digits = ((PyLongObject*)b)->ob_digit;
|
|
6370 |
const Py_ssize_t size = Py_SIZE(b);
|
|
6371 |
if (likely(__Pyx_sst_abs(size) <= 1)) {
|
|
6372 |
ival = likely(size) ? digits[0] : 0;
|
|
6373 |
if (size == -1) ival = -ival;
|
|
6374 |
return ival;
|
|
6375 |
} else {
|
|
6376 |
switch (size) {
|
|
6377 |
case 2:
|
|
6378 |
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
|
|
6379 |
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
|
|
6380 |
}
|
|
6381 |
break;
|
|
6382 |
case -2:
|
|
6383 |
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
|
|
6384 |
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
|
|
6385 |
}
|
|
6386 |
break;
|
|
6387 |
case 3:
|
|
6388 |
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
|
|
6389 |
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
|
|
6390 |
}
|
|
6391 |
break;
|
|
6392 |
case -3:
|
|
6393 |
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
|
|
6394 |
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
|
|
6395 |
}
|
|
6396 |
break;
|
|
6397 |
case 4:
|
|
6398 |
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
|
|
6399 |
return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
|
|
6400 |
}
|
|
6401 |
break;
|
|
6402 |
case -4:
|
|
6403 |
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
|
|
6404 |
return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
|
|
6405 |
}
|
|
6406 |
break;
|
|
6407 |
}
|
|
6408 |
}
|
|
6409 |
#endif
|
|
6410 |
return PyLong_AsSsize_t(b);
|
|
6411 |
}
|
|
6412 |
x = PyNumber_Index(b);
|
|
6413 |
if (!x) return -1;
|
|
6414 |
ival = PyInt_AsSsize_t(x);
|
|
6415 |
Py_DECREF(x);
|
|
6416 |
return ival;
|
|
6417 |
}
|
|
6418 |
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
|
|
6419 |
return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
|
|
6420 |
}
|
|
6421 |
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
|
|
6422 |
return PyInt_FromSize_t(ival);
|
|
6423 |
}
|
|
6424 |
|
|
6425 |
|
|
6426 |
#endif /* Py_PYTHON_H */
|