*/
static PyLongObject small_ints[NSMALLNEGINTS + NSMALLPOSINTS];
-static inline int
-is_small_int(long long ival)
-{
- return -NSMALLNEGINTS <= ival && ival < NSMALLPOSINTS;
-}
+#define IS_SMALL_INT(ival) (-NSMALLNEGINTS <= (ival) && (ival) < NSMALLPOSINTS)
#ifdef COUNT_ALLOCS
Py_ssize_t _Py_quick_int_allocs, _Py_quick_neg_int_allocs;
get_small_int(sdigit ival)
{
PyObject *v;
- assert(is_small_int(ival));
+ assert(IS_SMALL_INT(ival));
v = (PyObject *)&small_ints[ival + NSMALLNEGINTS];
Py_INCREF(v);
#ifdef COUNT_ALLOCS
{
if (v && Py_ABS(Py_SIZE(v)) <= 1) {
sdigit ival = MEDIUM_VALUE(v);
- if (is_small_int(ival)) {
+ if (IS_SMALL_INT(ival)) {
Py_DECREF(v);
return (PyLongObject *)get_small_int(ival);
}
return v;
}
#else
-#define is_small_int(ival) 0
-#define get_small_int(ival) (assert(0), NULL)
+#define IS_SMALL_INT(ival) 0
+#define get_small_int(ival) (Py_UNREACHABLE(), NULL)
#define maybe_small_long(val) (val)
#endif
i = -(i);
if (i < 2) {
sdigit ival = MEDIUM_VALUE(src);
- if (is_small_int(ival)) {
+ if (IS_SMALL_INT(ival)) {
return get_small_int(ival);
}
}
int ndigits = 0;
int sign;
- if (is_small_int(ival)) {
+ if (IS_SMALL_INT(ival)) {
return get_small_int((sdigit)ival);
}
int ndigits = 0;
int negative = 0;
- if (is_small_int(ival)) {
+ if (IS_SMALL_INT(ival)) {
return get_small_int((sdigit)ival);
}
int ndigits = 0;
int negative = 0;
- if (is_small_int(ival)) {
+ if (IS_SMALL_INT(ival)) {
return get_small_int((sdigit)ival);
}