7#include "nuitka/prelude.h"
12static PyObject *COMPARE_EQ_OBJECT_CLONG_CLONG(
long operand1,
long operand2) {
14 const long a = operand1;
15 const long b = operand2;
20 PyObject *result = BOOL_FROM(r);
21 Py_INCREF_IMMORTAL(result);
27 CHECK_NILONG_OBJECT(operand1);
28 CHECK_NILONG_OBJECT(operand2);
30 bool left_c_usable = IS_NILONG_C_VALUE_VALID(operand1);
31 bool right_c_usable = IS_NILONG_C_VALUE_VALID(operand2);
33 if (left_c_usable && right_c_usable) {
34 return COMPARE_EQ_OBJECT_CLONG_CLONG(operand1->c_value, operand2->c_value);
35 }
else if (!left_c_usable && !right_c_usable) {
36 return RICH_COMPARE_EQ_OBJECT_LONG_LONG(operand1->python_value, operand2->python_value);
40 r = COMPARE_EQ_CBOOL_LONG_CLONG(operand2->python_value, operand1->c_value);
43 r = COMPARE_EQ_CBOOL_LONG_CLONG(operand1->python_value, operand2->c_value);
47 PyObject *result = BOOL_FROM(r);
48 Py_INCREF_IMMORTAL(result);
53static bool COMPARE_EQ_CBOOL_CLONG_CLONG(
long operand1,
long operand2) {
55 const long a = operand1;
56 const long b = operand2;
68 CHECK_NILONG_OBJECT(operand1);
69 CHECK_NILONG_OBJECT(operand2);
71 bool left_c_usable = IS_NILONG_C_VALUE_VALID(operand1);
72 bool right_c_usable = IS_NILONG_C_VALUE_VALID(operand2);
74 if (left_c_usable && right_c_usable) {
75 return COMPARE_EQ_CBOOL_CLONG_CLONG(operand1->c_value, operand2->c_value);
76 }
else if (!left_c_usable && !right_c_usable) {
77 return RICH_COMPARE_EQ_CBOOL_LONG_LONG(operand1->python_value, operand2->python_value);
81 r = COMPARE_EQ_CBOOL_LONG_CLONG(operand2->python_value, operand1->c_value);
84 r = COMPARE_EQ_CBOOL_LONG_CLONG(operand1->python_value, operand2->c_value);
95PyObject *RICH_COMPARE_EQ_OBJECT_NILONG_CLONG(
nuitka_ilong *operand1,
long operand2) {
96 CHECK_NILONG_OBJECT(operand1);
98 bool left_c_usable = IS_NILONG_C_VALUE_VALID(operand1);
99 bool right_c_usable =
true;
101 if (left_c_usable && right_c_usable) {
102 return COMPARE_EQ_OBJECT_CLONG_CLONG(operand1->c_value, operand2);
103 }
else if (!left_c_usable && !right_c_usable) {
104 ENFORCE_NILONG_OBJECT_VALUE(operand1);
106 return COMPARE_EQ_OBJECT_LONG_CLONG(operand1->python_value, operand2);
108 return COMPARE_EQ_OBJECT_LONG_CLONG(operand1->python_value, operand2);
113bool RICH_COMPARE_EQ_CBOOL_NILONG_CLONG(
nuitka_ilong *operand1,
long operand2) {
114 CHECK_NILONG_OBJECT(operand1);
116 bool left_c_usable = IS_NILONG_C_VALUE_VALID(operand1);
117 bool right_c_usable =
true;
119 if (left_c_usable && right_c_usable) {
120 return COMPARE_EQ_CBOOL_CLONG_CLONG(operand1->c_value, operand2);
121 }
else if (!left_c_usable && !right_c_usable) {
122 ENFORCE_NILONG_OBJECT_VALUE(operand1);
124 return COMPARE_EQ_CBOOL_LONG_CLONG(operand1->python_value, operand2);
126 return COMPARE_EQ_CBOOL_LONG_CLONG(operand1->python_value, operand2);
132PyObject *RICH_COMPARE_EQ_OBJECT_NILONG_DIGIT(
nuitka_ilong *operand1,
long operand2) {
133 CHECK_NILONG_OBJECT(operand1);
134 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
136 bool left_c_usable = IS_NILONG_C_VALUE_VALID(operand1);
137 bool right_c_usable =
true;
139 if (left_c_usable && right_c_usable) {
140 return COMPARE_EQ_OBJECT_CLONG_CLONG(operand1->c_value, operand2);
141 }
else if (!left_c_usable && !right_c_usable) {
142 ENFORCE_NILONG_OBJECT_VALUE(operand1);
144 return COMPARE_EQ_OBJECT_LONG_DIGIT(operand1->python_value, operand2);
146 return COMPARE_EQ_OBJECT_LONG_DIGIT(operand1->python_value, operand2);
152bool RICH_COMPARE_EQ_CBOOL_NILONG_DIGIT(
nuitka_ilong *operand1,
long operand2) {
153 CHECK_NILONG_OBJECT(operand1);
154 assert(Py_ABS(operand2) < (1 << PyLong_SHIFT));
156 bool left_c_usable = IS_NILONG_C_VALUE_VALID(operand1);
157 bool right_c_usable =
true;
159 if (left_c_usable && right_c_usable) {
160 return COMPARE_EQ_CBOOL_CLONG_CLONG(operand1->c_value, operand2);
161 }
else if (!left_c_usable && !right_c_usable) {
162 ENFORCE_NILONG_OBJECT_VALUE(operand1);
164 return COMPARE_EQ_CBOOL_LONG_DIGIT(operand1->python_value, operand2);
166 return COMPARE_EQ_CBOOL_LONG_DIGIT(operand1->python_value, operand2);