7#include "nuitka/prelude.h"
13static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
14 CHECK_OBJECT(operand1);
15 assert(PyLong_CheckExact(operand1));
16 CHECK_OBJECT(operand2);
17 assert(PyLong_CheckExact(operand2));
24#pragma warning(disable : 4101)
26 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
27 NUITKA_MAY_BE_UNUSED
long clong_result;
32 PyObject *x = PyLong_Type.tp_as_number->nb_lshift(operand1, operand2);
33 assert(x != Py_NotImplemented);
36 goto exit_result_object;
39 if (unlikely(obj_result == NULL)) {
40 goto exit_result_exception;
52PyObject *BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(PyObject *operand1, PyObject *operand2) {
53 return _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1, operand2);
57static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_LONG(PyObject *operand1,
59 PyTypeObject *type1 = Py_TYPE(operand1);
63#pragma warning(disable : 4101)
65 NUITKA_MAY_BE_UNUSED
bool cbool_result;
66 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
72 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_lshift : NULL;
73 binaryfunc slot2 = NULL;
75 if (!(type1 == &PyLong_Type)) {
78 slot2 = PyLong_Type.tp_as_number->nb_lshift;
86 PyObject *x = slot1(operand1, operand2);
88 if (x != Py_NotImplemented) {
90 goto exit_binary_result_object;
93 Py_DECREF_IMMORTAL(x);
97 PyObject *x = slot2(operand1, operand2);
99 if (x != Py_NotImplemented) {
101 goto exit_binary_result_object;
104 Py_DECREF_IMMORTAL(x);
107#if PYTHON_VERSION < 0x300
108 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
110 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
113 PyObject *coerced1 = operand1;
114 PyObject *coerced2 = operand2;
116 int err = c1(&coerced1, &coerced2);
118 if (unlikely(err < 0)) {
119 goto exit_binary_exception;
123 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
125 if (likely(mv == NULL)) {
126 binaryfunc slot = mv->nb_lshift;
128 if (likely(slot != NULL)) {
129 PyObject *x = slot(coerced1, coerced2);
135 goto exit_binary_result_object;
144 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
147 PyObject *coerced1 = operand1;
148 PyObject *coerced2 = operand2;
150 int err = c2(&coerced2, &coerced1);
152 if (unlikely(err < 0)) {
153 goto exit_binary_exception;
157 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
159 if (likely(mv == NULL)) {
160 binaryfunc slot = mv->nb_lshift;
162 if (likely(slot != NULL)) {
163 PyObject *x = slot(coerced1, coerced2);
169 goto exit_binary_result_object;
181#if PYTHON_VERSION < 0x300
182 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and 'long'", type1->tp_name);
184 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and 'int'", type1->tp_name);
186 goto exit_binary_exception;
188exit_binary_result_object:
191exit_binary_exception:
194static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
195 CHECK_OBJECT(operand1);
196 CHECK_OBJECT(operand2);
197 assert(PyLong_CheckExact(operand2));
199 PyTypeObject *type1 = Py_TYPE(operand1);
201 if (type1 == &PyLong_Type) {
209#pragma warning(disable : 4101)
211 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
212 NUITKA_MAY_BE_UNUSED
long clong_result;
217 PyObject *x = PyLong_Type.tp_as_number->nb_lshift(operand1, operand2);
218 assert(x != Py_NotImplemented);
221 goto exit_result_object;
224 if (unlikely(obj_result == NULL)) {
225 goto exit_result_exception;
233 exit_result_exception:
237 return __BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_LONG(operand1, operand2);
240PyObject *BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
241 return _BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_LONG(operand1, operand2);
245static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_LSHIFT_OBJECT_LONG_OBJECT(PyObject *operand1,
246 PyObject *operand2) {
247 PyTypeObject *type2 = Py_TYPE(operand2);
251#pragma warning(disable : 4101)
253 NUITKA_MAY_BE_UNUSED
bool cbool_result;
254 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
259 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_lshift;
260 binaryfunc slot2 = NULL;
262 if (!(&PyLong_Type == type2)) {
265 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_lshift : NULL;
267 if (slot1 == slot2) {
274 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
275 PyObject *x = slot2(operand1, operand2);
277 if (x != Py_NotImplemented) {
279 goto exit_binary_result_object;
282 Py_DECREF_IMMORTAL(x);
287 PyObject *x = slot1(operand1, operand2);
289 if (x != Py_NotImplemented) {
291 goto exit_binary_result_object;
294 Py_DECREF_IMMORTAL(x);
298 PyObject *x = slot2(operand1, operand2);
300 if (x != Py_NotImplemented) {
302 goto exit_binary_result_object;
305 Py_DECREF_IMMORTAL(x);
308#if PYTHON_VERSION < 0x300
309 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
310 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
313 PyObject *coerced1 = operand1;
314 PyObject *coerced2 = operand2;
316 int err = c1(&coerced1, &coerced2);
318 if (unlikely(err < 0)) {
319 goto exit_binary_exception;
323 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
325 if (likely(mv == NULL)) {
326 binaryfunc slot = mv->nb_lshift;
328 if (likely(slot != NULL)) {
329 PyObject *x = slot(coerced1, coerced2);
335 goto exit_binary_result_object;
345 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
348 PyObject *coerced1 = operand1;
349 PyObject *coerced2 = operand2;
351 int err = c2(&coerced2, &coerced1);
353 if (unlikely(err < 0)) {
354 goto exit_binary_exception;
358 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
360 if (likely(mv == NULL)) {
361 binaryfunc slot = mv->nb_lshift;
363 if (likely(slot != NULL)) {
364 PyObject *x = slot(coerced1, coerced2);
370 goto exit_binary_result_object;
382#if PYTHON_VERSION < 0x300
383 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'long' and '%s'", type2->tp_name);
385 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'int' and '%s'", type2->tp_name);
387 goto exit_binary_exception;
389exit_binary_result_object:
392exit_binary_exception:
395static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
396 CHECK_OBJECT(operand1);
397 assert(PyLong_CheckExact(operand1));
398 CHECK_OBJECT(operand2);
400 PyTypeObject *type2 = Py_TYPE(operand2);
402 if (&PyLong_Type == type2) {
410#pragma warning(disable : 4101)
412 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
413 NUITKA_MAY_BE_UNUSED
long clong_result;
418 PyObject *x = PyLong_Type.tp_as_number->nb_lshift(operand1, operand2);
419 assert(x != Py_NotImplemented);
422 goto exit_result_object;
425 if (unlikely(obj_result == NULL)) {
426 goto exit_result_exception;
434 exit_result_exception:
438 return __BINARY_OPERATION_LSHIFT_OBJECT_LONG_OBJECT(operand1, operand2);
441PyObject *BINARY_OPERATION_LSHIFT_OBJECT_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
442 return _BINARY_OPERATION_LSHIFT_OBJECT_LONG_OBJECT(operand1, operand2);
446static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
447 CHECK_OBJECT(operand1);
448 assert(PyLong_CheckExact(operand1));
449 CHECK_OBJECT(operand2);
450 assert(PyLong_CheckExact(operand2));
457#pragma warning(disable : 4101)
459 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
460 NUITKA_MAY_BE_UNUSED
long clong_result;
465 PyObject *x = PyLong_Type.tp_as_number->nb_lshift(operand1, operand2);
466 assert(x != Py_NotImplemented);
469 goto exit_result_object;
472 if (unlikely(obj_result == NULL)) {
473 goto exit_result_exception;
475 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
476 Py_DECREF(obj_result);
482exit_result_exception:
483 return NUITKA_BOOL_EXCEPTION;
486nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_LONG_LONG(PyObject *operand1, PyObject *operand2) {
487 return _BINARY_OPERATION_LSHIFT_NBOOL_LONG_LONG(operand1, operand2);
491static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_LONG(PyObject *operand1,
492 PyObject *operand2) {
493 PyTypeObject *type1 = Py_TYPE(operand1);
497#pragma warning(disable : 4101)
499 NUITKA_MAY_BE_UNUSED
bool cbool_result;
500 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
506 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_lshift : NULL;
507 binaryfunc slot2 = NULL;
509 if (!(type1 == &PyLong_Type)) {
512 slot2 = PyLong_Type.tp_as_number->nb_lshift;
514 if (slot1 == slot2) {
520 PyObject *x = slot1(operand1, operand2);
522 if (x != Py_NotImplemented) {
524 goto exit_binary_result_object;
527 Py_DECREF_IMMORTAL(x);
531 PyObject *x = slot2(operand1, operand2);
533 if (x != Py_NotImplemented) {
535 goto exit_binary_result_object;
538 Py_DECREF_IMMORTAL(x);
541#if PYTHON_VERSION < 0x300
542 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
544 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
547 PyObject *coerced1 = operand1;
548 PyObject *coerced2 = operand2;
550 int err = c1(&coerced1, &coerced2);
552 if (unlikely(err < 0)) {
553 goto exit_binary_exception;
557 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
559 if (likely(mv == NULL)) {
560 binaryfunc slot = mv->nb_lshift;
562 if (likely(slot != NULL)) {
563 PyObject *x = slot(coerced1, coerced2);
569 goto exit_binary_result_object;
578 coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
581 PyObject *coerced1 = operand1;
582 PyObject *coerced2 = operand2;
584 int err = c2(&coerced2, &coerced1);
586 if (unlikely(err < 0)) {
587 goto exit_binary_exception;
591 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
593 if (likely(mv == NULL)) {
594 binaryfunc slot = mv->nb_lshift;
596 if (likely(slot != NULL)) {
597 PyObject *x = slot(coerced1, coerced2);
603 goto exit_binary_result_object;
615#if PYTHON_VERSION < 0x300
616 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and 'long'", type1->tp_name);
618 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and 'int'", type1->tp_name);
620 goto exit_binary_exception;
622exit_binary_result_object:
623 if (unlikely(obj_result == NULL)) {
624 return NUITKA_BOOL_EXCEPTION;
628 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
629 Py_DECREF(obj_result);
633exit_binary_exception:
634 return NUITKA_BOOL_EXCEPTION;
636static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
637 CHECK_OBJECT(operand1);
638 CHECK_OBJECT(operand2);
639 assert(PyLong_CheckExact(operand2));
641 PyTypeObject *type1 = Py_TYPE(operand1);
643 if (type1 == &PyLong_Type) {
651#pragma warning(disable : 4101)
653 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
654 NUITKA_MAY_BE_UNUSED
long clong_result;
659 PyObject *x = PyLong_Type.tp_as_number->nb_lshift(operand1, operand2);
660 assert(x != Py_NotImplemented);
663 goto exit_result_object;
666 if (unlikely(obj_result == NULL)) {
667 goto exit_result_exception;
669 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
670 Py_DECREF(obj_result);
676 exit_result_exception:
677 return NUITKA_BOOL_EXCEPTION;
680 return __BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_LONG(operand1, operand2);
683nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_LONG(PyObject *operand1, PyObject *operand2) {
684 return _BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_LONG(operand1, operand2);
688static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_LSHIFT_NBOOL_LONG_OBJECT(PyObject *operand1,
689 PyObject *operand2) {
690 PyTypeObject *type2 = Py_TYPE(operand2);
694#pragma warning(disable : 4101)
696 NUITKA_MAY_BE_UNUSED
bool cbool_result;
697 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
702 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_lshift;
703 binaryfunc slot2 = NULL;
705 if (!(&PyLong_Type == type2)) {
708 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_lshift : NULL;
710 if (slot1 == slot2) {
717 if (Nuitka_Type_IsSubtype(type2, &PyLong_Type)) {
718 PyObject *x = slot2(operand1, operand2);
720 if (x != Py_NotImplemented) {
722 goto exit_binary_result_object;
725 Py_DECREF_IMMORTAL(x);
730 PyObject *x = slot1(operand1, operand2);
732 if (x != Py_NotImplemented) {
734 goto exit_binary_result_object;
737 Py_DECREF_IMMORTAL(x);
741 PyObject *x = slot2(operand1, operand2);
743 if (x != Py_NotImplemented) {
745 goto exit_binary_result_object;
748 Py_DECREF_IMMORTAL(x);
751#if PYTHON_VERSION < 0x300
752 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
753 coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
756 PyObject *coerced1 = operand1;
757 PyObject *coerced2 = operand2;
759 int err = c1(&coerced1, &coerced2);
761 if (unlikely(err < 0)) {
762 goto exit_binary_exception;
766 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
768 if (likely(mv == NULL)) {
769 binaryfunc slot = mv->nb_lshift;
771 if (likely(slot != NULL)) {
772 PyObject *x = slot(coerced1, coerced2);
778 goto exit_binary_result_object;
788 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
791 PyObject *coerced1 = operand1;
792 PyObject *coerced2 = operand2;
794 int err = c2(&coerced2, &coerced1);
796 if (unlikely(err < 0)) {
797 goto exit_binary_exception;
801 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
803 if (likely(mv == NULL)) {
804 binaryfunc slot = mv->nb_lshift;
806 if (likely(slot != NULL)) {
807 PyObject *x = slot(coerced1, coerced2);
813 goto exit_binary_result_object;
825#if PYTHON_VERSION < 0x300
826 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'long' and '%s'", type2->tp_name);
828 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'int' and '%s'", type2->tp_name);
830 goto exit_binary_exception;
832exit_binary_result_object:
833 if (unlikely(obj_result == NULL)) {
834 return NUITKA_BOOL_EXCEPTION;
838 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
839 Py_DECREF(obj_result);
843exit_binary_exception:
844 return NUITKA_BOOL_EXCEPTION;
846static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
847 CHECK_OBJECT(operand1);
848 assert(PyLong_CheckExact(operand1));
849 CHECK_OBJECT(operand2);
851 PyTypeObject *type2 = Py_TYPE(operand2);
853 if (&PyLong_Type == type2) {
861#pragma warning(disable : 4101)
863 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
864 NUITKA_MAY_BE_UNUSED
long clong_result;
869 PyObject *x = PyLong_Type.tp_as_number->nb_lshift(operand1, operand2);
870 assert(x != Py_NotImplemented);
873 goto exit_result_object;
876 if (unlikely(obj_result == NULL)) {
877 goto exit_result_exception;
879 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
880 Py_DECREF(obj_result);
886 exit_result_exception:
887 return NUITKA_BOOL_EXCEPTION;
890 return __BINARY_OPERATION_LSHIFT_NBOOL_LONG_OBJECT(operand1, operand2);
893nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_LONG_OBJECT(PyObject *operand1, PyObject *operand2) {
894 return _BINARY_OPERATION_LSHIFT_NBOOL_LONG_OBJECT(operand1, operand2);
897#if PYTHON_VERSION < 0x300
899static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
900 CHECK_OBJECT(operand1);
901 assert(PyInt_CheckExact(operand1));
902 CHECK_OBJECT(operand2);
903 assert(PyInt_CheckExact(operand2));
910#pragma warning(disable : 4101)
912 NUITKA_MAY_BE_UNUSED
bool cbool_result;
913 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
914 NUITKA_MAY_BE_UNUSED
long clong_result;
915 NUITKA_MAY_BE_UNUSED
double cfloat_result;
920 CHECK_OBJECT(operand1);
921 assert(PyInt_CheckExact(operand1));
922 CHECK_OBJECT(operand2);
923 assert(PyInt_CheckExact(operand2));
925 const long a = PyInt_AS_LONG(operand1);
926 const long b = PyInt_AS_LONG(operand2);
928 if (unlikely(b < 0)) {
929 PyThreadState *tstate = PyThreadState_GET();
931 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
932 goto exit_result_exception;
935 if (a == 0 || b == 0) {
936 goto exit_result_ok_left;
937 }
else if (b >= LONG_BIT) {
938 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
939 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
942 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
944 Py_DECREF(operand1_long);
945 Py_DECREF(operand2_long);
948 goto exit_result_object;
952 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
953 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
954 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
957 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
959 Py_DECREF(operand1_long);
960 Py_DECREF(operand2_long);
963 goto exit_result_object;
966 goto exit_result_ok_clong;
971 result = Nuitka_PyInt_FromLong(clong_result);
980 if (unlikely(obj_result == NULL)) {
981 goto exit_result_exception;
989exit_result_exception:
993PyObject *BINARY_OPERATION_LSHIFT_OBJECT_INT_INT(PyObject *operand1, PyObject *operand2) {
994 return _BINARY_OPERATION_LSHIFT_OBJECT_INT_INT(operand1, operand2);
998#if PYTHON_VERSION < 0x300
1000static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_INT(PyObject *operand1,
1001 PyObject *operand2) {
1002 PyTypeObject *type1 = Py_TYPE(operand1);
1004#if defined(_MSC_VER)
1005#pragma warning(push)
1006#pragma warning(disable : 4101)
1008 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1009 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1010#if defined(_MSC_VER)
1015 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_lshift : NULL;
1016 binaryfunc slot2 = NULL;
1018 if (!(type1 == &PyInt_Type)) {
1021 slot2 = PyInt_Type.tp_as_number->nb_lshift;
1023 if (slot1 == slot2) {
1028 if (slot1 != NULL) {
1029 PyObject *x = slot1(operand1, operand2);
1031 if (x != Py_NotImplemented) {
1033 goto exit_binary_result_object;
1036 Py_DECREF_IMMORTAL(x);
1039 if (slot2 != NULL) {
1040 PyObject *x = slot2(operand1, operand2);
1042 if (x != Py_NotImplemented) {
1044 goto exit_binary_result_object;
1047 Py_DECREF_IMMORTAL(x);
1050#if PYTHON_VERSION < 0x300
1051 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1053 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1056 PyObject *coerced1 = operand1;
1057 PyObject *coerced2 = operand2;
1059 int err = c1(&coerced1, &coerced2);
1061 if (unlikely(err < 0)) {
1062 goto exit_binary_exception;
1066 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1068 if (likely(mv == NULL)) {
1069 binaryfunc slot = mv->nb_lshift;
1071 if (likely(slot != NULL)) {
1072 PyObject *x = slot(coerced1, coerced2);
1074 Py_DECREF(coerced1);
1075 Py_DECREF(coerced2);
1078 goto exit_binary_result_object;
1083 Py_DECREF(coerced1);
1084 Py_DECREF(coerced2);
1087 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
1090 PyObject *coerced1 = operand1;
1091 PyObject *coerced2 = operand2;
1093 int err = c2(&coerced2, &coerced1);
1095 if (unlikely(err < 0)) {
1096 goto exit_binary_exception;
1100 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1102 if (likely(mv == NULL)) {
1103 binaryfunc slot = mv->nb_lshift;
1105 if (likely(slot != NULL)) {
1106 PyObject *x = slot(coerced1, coerced2);
1108 Py_DECREF(coerced1);
1109 Py_DECREF(coerced2);
1112 goto exit_binary_result_object;
1117 Py_DECREF(coerced1);
1118 Py_DECREF(coerced2);
1124 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and 'int'", type1->tp_name);
1125 goto exit_binary_exception;
1127exit_binary_result_object:
1130exit_binary_exception:
1133static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
1134 CHECK_OBJECT(operand1);
1135 CHECK_OBJECT(operand2);
1136 assert(PyInt_CheckExact(operand2));
1138 PyTypeObject *type1 = Py_TYPE(operand1);
1140 if (type1 == &PyInt_Type) {
1146#if defined(_MSC_VER)
1147#pragma warning(push)
1148#pragma warning(disable : 4101)
1150 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1151 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1152 NUITKA_MAY_BE_UNUSED
long clong_result;
1153 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1154#if defined(_MSC_VER)
1158 CHECK_OBJECT(operand1);
1159 assert(PyInt_CheckExact(operand1));
1160 CHECK_OBJECT(operand2);
1161 assert(PyInt_CheckExact(operand2));
1163 const long a = PyInt_AS_LONG(operand1);
1164 const long b = PyInt_AS_LONG(operand2);
1166 if (unlikely(b < 0)) {
1167 PyThreadState *tstate = PyThreadState_GET();
1169 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
1170 goto exit_result_exception;
1173 if (a == 0 || b == 0) {
1174 goto exit_result_ok_left;
1175 }
else if (b >= LONG_BIT) {
1176 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1177 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1180 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1182 Py_DECREF(operand1_long);
1183 Py_DECREF(operand2_long);
1186 goto exit_result_object;
1190 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
1191 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1192 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1195 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1197 Py_DECREF(operand1_long);
1198 Py_DECREF(operand2_long);
1201 goto exit_result_object;
1204 goto exit_result_ok_clong;
1208 exit_result_ok_clong:
1209 result = Nuitka_PyInt_FromLong(clong_result);
1210 goto exit_result_ok;
1212 exit_result_ok_left:
1215 goto exit_result_ok;
1218 if (unlikely(obj_result == NULL)) {
1219 goto exit_result_exception;
1221 result = obj_result;
1222 goto exit_result_ok;
1227 exit_result_exception:
1231 return __BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_INT(operand1, operand2);
1234PyObject *BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
1235 return _BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_INT(operand1, operand2);
1239#if PYTHON_VERSION < 0x300
1241static HEDLEY_NEVER_INLINE PyObject *__BINARY_OPERATION_LSHIFT_OBJECT_INT_OBJECT(PyObject *operand1,
1242 PyObject *operand2) {
1243 PyTypeObject *type2 = Py_TYPE(operand2);
1245#if defined(_MSC_VER)
1246#pragma warning(push)
1247#pragma warning(disable : 4101)
1249 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1250 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1251#if defined(_MSC_VER)
1255 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_lshift;
1256 binaryfunc slot2 = NULL;
1258 if (!(&PyInt_Type == type2)) {
1261 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_lshift : NULL;
1263 if (slot1 == slot2) {
1268 if (slot1 != NULL) {
1269 if (slot2 != NULL) {
1270 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
1271 PyObject *x = slot2(operand1, operand2);
1273 if (x != Py_NotImplemented) {
1275 goto exit_binary_result_object;
1278 Py_DECREF_IMMORTAL(x);
1283 PyObject *x = slot1(operand1, operand2);
1285 if (x != Py_NotImplemented) {
1287 goto exit_binary_result_object;
1290 Py_DECREF_IMMORTAL(x);
1293 if (slot2 != NULL) {
1294 PyObject *x = slot2(operand1, operand2);
1296 if (x != Py_NotImplemented) {
1298 goto exit_binary_result_object;
1301 Py_DECREF_IMMORTAL(x);
1304#if PYTHON_VERSION < 0x300
1305 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1306 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
1309 PyObject *coerced1 = operand1;
1310 PyObject *coerced2 = operand2;
1312 int err = c1(&coerced1, &coerced2);
1314 if (unlikely(err < 0)) {
1315 goto exit_binary_exception;
1319 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1321 if (likely(mv == NULL)) {
1322 binaryfunc slot = mv->nb_lshift;
1324 if (likely(slot != NULL)) {
1325 PyObject *x = slot(coerced1, coerced2);
1327 Py_DECREF(coerced1);
1328 Py_DECREF(coerced2);
1331 goto exit_binary_result_object;
1336 Py_DECREF(coerced1);
1337 Py_DECREF(coerced2);
1341 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1344 PyObject *coerced1 = operand1;
1345 PyObject *coerced2 = operand2;
1347 int err = c2(&coerced2, &coerced1);
1349 if (unlikely(err < 0)) {
1350 goto exit_binary_exception;
1354 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1356 if (likely(mv == NULL)) {
1357 binaryfunc slot = mv->nb_lshift;
1359 if (likely(slot != NULL)) {
1360 PyObject *x = slot(coerced1, coerced2);
1362 Py_DECREF(coerced1);
1363 Py_DECREF(coerced2);
1366 goto exit_binary_result_object;
1371 Py_DECREF(coerced1);
1372 Py_DECREF(coerced2);
1378 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'int' and '%s'", type2->tp_name);
1379 goto exit_binary_exception;
1381exit_binary_result_object:
1384exit_binary_exception:
1387static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
1388 CHECK_OBJECT(operand1);
1389 assert(PyInt_CheckExact(operand1));
1390 CHECK_OBJECT(operand2);
1392 PyTypeObject *type2 = Py_TYPE(operand2);
1394 if (&PyInt_Type == type2) {
1400#if defined(_MSC_VER)
1401#pragma warning(push)
1402#pragma warning(disable : 4101)
1404 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1405 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1406 NUITKA_MAY_BE_UNUSED
long clong_result;
1407 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1408#if defined(_MSC_VER)
1412 CHECK_OBJECT(operand1);
1413 assert(PyInt_CheckExact(operand1));
1414 CHECK_OBJECT(operand2);
1415 assert(PyInt_CheckExact(operand2));
1417 const long a = PyInt_AS_LONG(operand1);
1418 const long b = PyInt_AS_LONG(operand2);
1420 if (unlikely(b < 0)) {
1421 PyThreadState *tstate = PyThreadState_GET();
1423 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
1424 goto exit_result_exception;
1427 if (a == 0 || b == 0) {
1428 goto exit_result_ok_left;
1429 }
else if (b >= LONG_BIT) {
1430 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1431 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1434 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1436 Py_DECREF(operand1_long);
1437 Py_DECREF(operand2_long);
1440 goto exit_result_object;
1444 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
1445 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1446 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1449 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1451 Py_DECREF(operand1_long);
1452 Py_DECREF(operand2_long);
1455 goto exit_result_object;
1458 goto exit_result_ok_clong;
1462 exit_result_ok_clong:
1463 result = Nuitka_PyInt_FromLong(clong_result);
1464 goto exit_result_ok;
1466 exit_result_ok_left:
1469 goto exit_result_ok;
1472 if (unlikely(obj_result == NULL)) {
1473 goto exit_result_exception;
1475 result = obj_result;
1476 goto exit_result_ok;
1481 exit_result_exception:
1485 return __BINARY_OPERATION_LSHIFT_OBJECT_INT_OBJECT(operand1, operand2);
1488PyObject *BINARY_OPERATION_LSHIFT_OBJECT_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
1489 return _BINARY_OPERATION_LSHIFT_OBJECT_INT_OBJECT(operand1, operand2);
1493#if PYTHON_VERSION < 0x300
1495static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_INT_INT(PyObject *operand1, PyObject *operand2) {
1496 CHECK_OBJECT(operand1);
1497 assert(PyInt_CheckExact(operand1));
1498 CHECK_OBJECT(operand2);
1499 assert(PyInt_CheckExact(operand2));
1504#if defined(_MSC_VER)
1505#pragma warning(push)
1506#pragma warning(disable : 4101)
1508 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1509 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1510 NUITKA_MAY_BE_UNUSED
long clong_result;
1511 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1512#if defined(_MSC_VER)
1516 CHECK_OBJECT(operand1);
1517 assert(PyInt_CheckExact(operand1));
1518 CHECK_OBJECT(operand2);
1519 assert(PyInt_CheckExact(operand2));
1521 const long a = PyInt_AS_LONG(operand1);
1522 const long b = PyInt_AS_LONG(operand2);
1524 if (unlikely(b < 0)) {
1525 PyThreadState *tstate = PyThreadState_GET();
1527 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
1528 goto exit_result_exception;
1531 if (a == 0 || b == 0) {
1532 goto exit_result_ok_left;
1533 }
else if (b >= LONG_BIT) {
1534 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1535 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1538 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1540 Py_DECREF(operand1_long);
1541 Py_DECREF(operand2_long);
1544 goto exit_result_object;
1548 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
1549 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1550 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1553 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1555 Py_DECREF(operand1_long);
1556 Py_DECREF(operand2_long);
1559 goto exit_result_object;
1562 goto exit_result_ok_clong;
1566exit_result_ok_clong:
1567 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1568 goto exit_result_ok;
1571 result = PyInt_AS_LONG(operand1) != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1572 goto exit_result_ok;
1575 if (unlikely(obj_result == NULL)) {
1576 goto exit_result_exception;
1578 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1579 Py_DECREF(obj_result);
1580 goto exit_result_ok;
1585exit_result_exception:
1586 return NUITKA_BOOL_EXCEPTION;
1589nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_INT_INT(PyObject *operand1, PyObject *operand2) {
1590 return _BINARY_OPERATION_LSHIFT_NBOOL_INT_INT(operand1, operand2);
1594#if PYTHON_VERSION < 0x300
1596static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_INT(PyObject *operand1,
1597 PyObject *operand2) {
1598 PyTypeObject *type1 = Py_TYPE(operand1);
1600#if defined(_MSC_VER)
1601#pragma warning(push)
1602#pragma warning(disable : 4101)
1604 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1605 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1606#if defined(_MSC_VER)
1611 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_lshift : NULL;
1612 binaryfunc slot2 = NULL;
1614 if (!(type1 == &PyInt_Type)) {
1617 slot2 = PyInt_Type.tp_as_number->nb_lshift;
1619 if (slot1 == slot2) {
1624 if (slot1 != NULL) {
1625 PyObject *x = slot1(operand1, operand2);
1627 if (x != Py_NotImplemented) {
1629 goto exit_binary_result_object;
1632 Py_DECREF_IMMORTAL(x);
1635 if (slot2 != NULL) {
1636 PyObject *x = slot2(operand1, operand2);
1638 if (x != Py_NotImplemented) {
1640 goto exit_binary_result_object;
1643 Py_DECREF_IMMORTAL(x);
1646#if PYTHON_VERSION < 0x300
1647 if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1649 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1652 PyObject *coerced1 = operand1;
1653 PyObject *coerced2 = operand2;
1655 int err = c1(&coerced1, &coerced2);
1657 if (unlikely(err < 0)) {
1658 goto exit_binary_exception;
1662 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1664 if (likely(mv == NULL)) {
1665 binaryfunc slot = mv->nb_lshift;
1667 if (likely(slot != NULL)) {
1668 PyObject *x = slot(coerced1, coerced2);
1670 Py_DECREF(coerced1);
1671 Py_DECREF(coerced2);
1674 goto exit_binary_result_object;
1679 Py_DECREF(coerced1);
1680 Py_DECREF(coerced2);
1683 coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
1686 PyObject *coerced1 = operand1;
1687 PyObject *coerced2 = operand2;
1689 int err = c2(&coerced2, &coerced1);
1691 if (unlikely(err < 0)) {
1692 goto exit_binary_exception;
1696 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1698 if (likely(mv == NULL)) {
1699 binaryfunc slot = mv->nb_lshift;
1701 if (likely(slot != NULL)) {
1702 PyObject *x = slot(coerced1, coerced2);
1704 Py_DECREF(coerced1);
1705 Py_DECREF(coerced2);
1708 goto exit_binary_result_object;
1713 Py_DECREF(coerced1);
1714 Py_DECREF(coerced2);
1720 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and 'int'", type1->tp_name);
1721 goto exit_binary_exception;
1723exit_binary_result_object:
1724 if (unlikely(obj_result == NULL)) {
1725 return NUITKA_BOOL_EXCEPTION;
1729 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1730 Py_DECREF(obj_result);
1734exit_binary_exception:
1735 return NUITKA_BOOL_EXCEPTION;
1737static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
1738 CHECK_OBJECT(operand1);
1739 CHECK_OBJECT(operand2);
1740 assert(PyInt_CheckExact(operand2));
1742 PyTypeObject *type1 = Py_TYPE(operand1);
1744 if (type1 == &PyInt_Type) {
1750#if defined(_MSC_VER)
1751#pragma warning(push)
1752#pragma warning(disable : 4101)
1754 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1755 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1756 NUITKA_MAY_BE_UNUSED
long clong_result;
1757 NUITKA_MAY_BE_UNUSED
double cfloat_result;
1758#if defined(_MSC_VER)
1762 CHECK_OBJECT(operand1);
1763 assert(PyInt_CheckExact(operand1));
1764 CHECK_OBJECT(operand2);
1765 assert(PyInt_CheckExact(operand2));
1767 const long a = PyInt_AS_LONG(operand1);
1768 const long b = PyInt_AS_LONG(operand2);
1770 if (unlikely(b < 0)) {
1771 PyThreadState *tstate = PyThreadState_GET();
1773 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
1774 goto exit_result_exception;
1777 if (a == 0 || b == 0) {
1778 goto exit_result_ok_left;
1779 }
else if (b >= LONG_BIT) {
1780 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1781 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1784 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1786 Py_DECREF(operand1_long);
1787 Py_DECREF(operand2_long);
1790 goto exit_result_object;
1794 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
1795 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
1796 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
1799 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
1801 Py_DECREF(operand1_long);
1802 Py_DECREF(operand2_long);
1805 goto exit_result_object;
1808 goto exit_result_ok_clong;
1812 exit_result_ok_clong:
1813 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1814 goto exit_result_ok;
1816 exit_result_ok_left:
1817 result = PyInt_AS_LONG(operand1) != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1818 goto exit_result_ok;
1821 if (unlikely(obj_result == NULL)) {
1822 goto exit_result_exception;
1824 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1825 Py_DECREF(obj_result);
1826 goto exit_result_ok;
1831 exit_result_exception:
1832 return NUITKA_BOOL_EXCEPTION;
1835 return __BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_INT(operand1, operand2);
1838nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_INT(PyObject *operand1, PyObject *operand2) {
1839 return _BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_INT(operand1, operand2);
1843#if PYTHON_VERSION < 0x300
1845static HEDLEY_NEVER_INLINE nuitka_bool __BINARY_OPERATION_LSHIFT_NBOOL_INT_OBJECT(PyObject *operand1,
1846 PyObject *operand2) {
1847 PyTypeObject *type2 = Py_TYPE(operand2);
1849#if defined(_MSC_VER)
1850#pragma warning(push)
1851#pragma warning(disable : 4101)
1853 NUITKA_MAY_BE_UNUSED
bool cbool_result;
1854 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
1855#if defined(_MSC_VER)
1859 binaryfunc slot1 = PyInt_Type.tp_as_number->nb_lshift;
1860 binaryfunc slot2 = NULL;
1862 if (!(&PyInt_Type == type2)) {
1865 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_lshift : NULL;
1867 if (slot1 == slot2) {
1872 if (slot1 != NULL) {
1873 if (slot2 != NULL) {
1874 if (Nuitka_Type_IsSubtype(type2, &PyInt_Type)) {
1875 PyObject *x = slot2(operand1, operand2);
1877 if (x != Py_NotImplemented) {
1879 goto exit_binary_result_object;
1882 Py_DECREF_IMMORTAL(x);
1887 PyObject *x = slot1(operand1, operand2);
1889 if (x != Py_NotImplemented) {
1891 goto exit_binary_result_object;
1894 Py_DECREF_IMMORTAL(x);
1897 if (slot2 != NULL) {
1898 PyObject *x = slot2(operand1, operand2);
1900 if (x != Py_NotImplemented) {
1902 goto exit_binary_result_object;
1905 Py_DECREF_IMMORTAL(x);
1908#if PYTHON_VERSION < 0x300
1909 if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1910 coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
1913 PyObject *coerced1 = operand1;
1914 PyObject *coerced2 = operand2;
1916 int err = c1(&coerced1, &coerced2);
1918 if (unlikely(err < 0)) {
1919 goto exit_binary_exception;
1923 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1925 if (likely(mv == NULL)) {
1926 binaryfunc slot = mv->nb_lshift;
1928 if (likely(slot != NULL)) {
1929 PyObject *x = slot(coerced1, coerced2);
1931 Py_DECREF(coerced1);
1932 Py_DECREF(coerced2);
1935 goto exit_binary_result_object;
1940 Py_DECREF(coerced1);
1941 Py_DECREF(coerced2);
1945 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1948 PyObject *coerced1 = operand1;
1949 PyObject *coerced2 = operand2;
1951 int err = c2(&coerced2, &coerced1);
1953 if (unlikely(err < 0)) {
1954 goto exit_binary_exception;
1958 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1960 if (likely(mv == NULL)) {
1961 binaryfunc slot = mv->nb_lshift;
1963 if (likely(slot != NULL)) {
1964 PyObject *x = slot(coerced1, coerced2);
1966 Py_DECREF(coerced1);
1967 Py_DECREF(coerced2);
1970 goto exit_binary_result_object;
1975 Py_DECREF(coerced1);
1976 Py_DECREF(coerced2);
1982 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'int' and '%s'", type2->tp_name);
1983 goto exit_binary_exception;
1985exit_binary_result_object:
1986 if (unlikely(obj_result == NULL)) {
1987 return NUITKA_BOOL_EXCEPTION;
1991 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
1992 Py_DECREF(obj_result);
1996exit_binary_exception:
1997 return NUITKA_BOOL_EXCEPTION;
1999static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
2000 CHECK_OBJECT(operand1);
2001 assert(PyInt_CheckExact(operand1));
2002 CHECK_OBJECT(operand2);
2004 PyTypeObject *type2 = Py_TYPE(operand2);
2006 if (&PyInt_Type == type2) {
2012#if defined(_MSC_VER)
2013#pragma warning(push)
2014#pragma warning(disable : 4101)
2016 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2017 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2018 NUITKA_MAY_BE_UNUSED
long clong_result;
2019 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2020#if defined(_MSC_VER)
2024 CHECK_OBJECT(operand1);
2025 assert(PyInt_CheckExact(operand1));
2026 CHECK_OBJECT(operand2);
2027 assert(PyInt_CheckExact(operand2));
2029 const long a = PyInt_AS_LONG(operand1);
2030 const long b = PyInt_AS_LONG(operand2);
2032 if (unlikely(b < 0)) {
2033 PyThreadState *tstate = PyThreadState_GET();
2035 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
2036 goto exit_result_exception;
2039 if (a == 0 || b == 0) {
2040 goto exit_result_ok_left;
2041 }
else if (b >= LONG_BIT) {
2042 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
2043 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
2046 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
2048 Py_DECREF(operand1_long);
2049 Py_DECREF(operand2_long);
2052 goto exit_result_object;
2056 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
2057 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
2058 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
2061 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
2063 Py_DECREF(operand1_long);
2064 Py_DECREF(operand2_long);
2067 goto exit_result_object;
2070 goto exit_result_ok_clong;
2074 exit_result_ok_clong:
2075 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2076 goto exit_result_ok;
2078 exit_result_ok_left:
2079 result = PyInt_AS_LONG(operand1) != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2080 goto exit_result_ok;
2083 if (unlikely(obj_result == NULL)) {
2084 goto exit_result_exception;
2086 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2087 Py_DECREF(obj_result);
2088 goto exit_result_ok;
2093 exit_result_exception:
2094 return NUITKA_BOOL_EXCEPTION;
2097 return __BINARY_OPERATION_LSHIFT_NBOOL_INT_OBJECT(operand1, operand2);
2100nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_INT_OBJECT(PyObject *operand1, PyObject *operand2) {
2101 return _BINARY_OPERATION_LSHIFT_NBOOL_INT_OBJECT(operand1, operand2);
2105#if PYTHON_VERSION < 0x300
2107static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
2108 CHECK_OBJECT(operand1);
2109 assert(PyLong_CheckExact(operand1));
2110 CHECK_OBJECT(operand2);
2111 assert(PyInt_CheckExact(operand2));
2113#if defined(_MSC_VER)
2114#pragma warning(push)
2115#pragma warning(disable : 4101)
2117 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2118 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2119#if defined(_MSC_VER)
2123 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_lshift;
2126 if (slot1 != NULL) {
2127 PyObject *x = slot1(operand1, operand2);
2129 if (x != Py_NotImplemented) {
2131 goto exit_binary_result_object;
2134 Py_DECREF_IMMORTAL(x);
2139 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'long' and 'int'");
2140 goto exit_binary_exception;
2142exit_binary_result_object:
2145exit_binary_exception:
2149PyObject *BINARY_OPERATION_LSHIFT_OBJECT_LONG_INT(PyObject *operand1, PyObject *operand2) {
2150 return _BINARY_OPERATION_LSHIFT_OBJECT_LONG_INT(operand1, operand2);
2154#if PYTHON_VERSION < 0x300
2156static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_INT_LONG(PyObject *operand1, PyObject *operand2) {
2157 CHECK_OBJECT(operand1);
2158 assert(PyInt_CheckExact(operand1));
2159 CHECK_OBJECT(operand2);
2160 assert(PyLong_CheckExact(operand2));
2162#if defined(_MSC_VER)
2163#pragma warning(push)
2164#pragma warning(disable : 4101)
2166 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2167 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2168#if defined(_MSC_VER)
2173 binaryfunc slot2 = NULL;
2178 slot2 = PyLong_Type.tp_as_number->nb_lshift;
2181 if (slot2 != NULL) {
2182 PyObject *x = slot2(operand1, operand2);
2184 if (x != Py_NotImplemented) {
2186 goto exit_binary_result_object;
2189 Py_DECREF_IMMORTAL(x);
2194 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'int' and 'long'");
2195 goto exit_binary_exception;
2197exit_binary_result_object:
2200exit_binary_exception:
2204PyObject *BINARY_OPERATION_LSHIFT_OBJECT_INT_LONG(PyObject *operand1, PyObject *operand2) {
2205 return _BINARY_OPERATION_LSHIFT_OBJECT_INT_LONG(operand1, operand2);
2209#if PYTHON_VERSION < 0x300
2211static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
2212 CHECK_OBJECT(operand1);
2213 assert(PyLong_CheckExact(operand1));
2214 CHECK_OBJECT(operand2);
2215 assert(PyInt_CheckExact(operand2));
2217#if defined(_MSC_VER)
2218#pragma warning(push)
2219#pragma warning(disable : 4101)
2221 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2222 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2223#if defined(_MSC_VER)
2227 binaryfunc slot1 = PyLong_Type.tp_as_number->nb_lshift;
2230 if (slot1 != NULL) {
2231 PyObject *x = slot1(operand1, operand2);
2233 if (x != Py_NotImplemented) {
2235 goto exit_binary_result_object;
2238 Py_DECREF_IMMORTAL(x);
2243 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'long' and 'int'");
2244 goto exit_binary_exception;
2246exit_binary_result_object:
2247 if (unlikely(obj_result == NULL)) {
2248 return NUITKA_BOOL_EXCEPTION;
2252 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2253 Py_DECREF(obj_result);
2257exit_binary_exception:
2258 return NUITKA_BOOL_EXCEPTION;
2261nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_LONG_INT(PyObject *operand1, PyObject *operand2) {
2262 return _BINARY_OPERATION_LSHIFT_NBOOL_LONG_INT(operand1, operand2);
2266#if PYTHON_VERSION < 0x300
2268static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_INT_LONG(PyObject *operand1, PyObject *operand2) {
2269 CHECK_OBJECT(operand1);
2270 assert(PyInt_CheckExact(operand1));
2271 CHECK_OBJECT(operand2);
2272 assert(PyLong_CheckExact(operand2));
2274#if defined(_MSC_VER)
2275#pragma warning(push)
2276#pragma warning(disable : 4101)
2278 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2279 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2280#if defined(_MSC_VER)
2285 binaryfunc slot2 = NULL;
2290 slot2 = PyLong_Type.tp_as_number->nb_lshift;
2293 if (slot2 != NULL) {
2294 PyObject *x = slot2(operand1, operand2);
2296 if (x != Py_NotImplemented) {
2298 goto exit_binary_result_object;
2301 Py_DECREF_IMMORTAL(x);
2306 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: 'int' and 'long'");
2307 goto exit_binary_exception;
2309exit_binary_result_object:
2310 if (unlikely(obj_result == NULL)) {
2311 return NUITKA_BOOL_EXCEPTION;
2315 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2316 Py_DECREF(obj_result);
2320exit_binary_exception:
2321 return NUITKA_BOOL_EXCEPTION;
2324nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_INT_LONG(PyObject *operand1, PyObject *operand2) {
2325 return _BINARY_OPERATION_LSHIFT_NBOOL_INT_LONG(operand1, operand2);
2330static PyObject *_BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
2331 CHECK_OBJECT(operand1);
2332 CHECK_OBJECT(operand2);
2334#if PYTHON_VERSION < 0x300
2335 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
2339#if defined(_MSC_VER)
2340#pragma warning(push)
2341#pragma warning(disable : 4101)
2343 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2344 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2345 NUITKA_MAY_BE_UNUSED
long clong_result;
2346 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2347#if defined(_MSC_VER)
2351 CHECK_OBJECT(operand1);
2352 assert(PyInt_CheckExact(operand1));
2353 CHECK_OBJECT(operand2);
2354 assert(PyInt_CheckExact(operand2));
2356 const long a = PyInt_AS_LONG(operand1);
2357 const long b = PyInt_AS_LONG(operand2);
2359 if (unlikely(b < 0)) {
2360 PyThreadState *tstate = PyThreadState_GET();
2362 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
2363 goto exit_result_exception;
2366 if (a == 0 || b == 0) {
2367 goto exit_result_ok_left;
2368 }
else if (b >= LONG_BIT) {
2369 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
2370 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
2373 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
2375 Py_DECREF(operand1_long);
2376 Py_DECREF(operand2_long);
2379 goto exit_result_object;
2383 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
2384 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
2385 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
2388 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
2390 Py_DECREF(operand1_long);
2391 Py_DECREF(operand2_long);
2394 goto exit_result_object;
2397 goto exit_result_ok_clong;
2401 exit_result_ok_clong:
2402 result = Nuitka_PyInt_FromLong(clong_result);
2403 goto exit_result_ok;
2405 exit_result_ok_left:
2408 goto exit_result_ok;
2411 if (unlikely(obj_result == NULL)) {
2412 goto exit_result_exception;
2414 result = obj_result;
2415 goto exit_result_ok;
2420 exit_result_exception:
2425 PyTypeObject *type1 = Py_TYPE(operand1);
2426 PyTypeObject *type2 = Py_TYPE(operand2);
2428#if defined(_MSC_VER)
2429#pragma warning(push)
2430#pragma warning(disable : 4101)
2432 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2433 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2434#if defined(_MSC_VER)
2439 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_lshift : NULL;
2440 binaryfunc slot2 = NULL;
2442 if (!(type1 == type2)) {
2445 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_lshift : NULL;
2447 if (slot1 == slot2) {
2452 if (slot1 != NULL) {
2453 if (slot2 != NULL) {
2454 if (Nuitka_Type_IsSubtype(type2, type1)) {
2455 PyObject *x = slot2(operand1, operand2);
2457 if (x != Py_NotImplemented) {
2459 goto exit_binary_result_object;
2462 Py_DECREF_IMMORTAL(x);
2467 PyObject *x = slot1(operand1, operand2);
2469 if (x != Py_NotImplemented) {
2471 goto exit_binary_result_object;
2474 Py_DECREF_IMMORTAL(x);
2477 if (slot2 != NULL) {
2478 PyObject *x = slot2(operand1, operand2);
2480 if (x != Py_NotImplemented) {
2482 goto exit_binary_result_object;
2485 Py_DECREF_IMMORTAL(x);
2488#if PYTHON_VERSION < 0x300
2489 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
2491 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2494 PyObject *coerced1 = operand1;
2495 PyObject *coerced2 = operand2;
2497 int err = c1(&coerced1, &coerced2);
2499 if (unlikely(err < 0)) {
2500 goto exit_binary_exception;
2504 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2506 if (likely(mv == NULL)) {
2507 binaryfunc slot = mv->nb_lshift;
2509 if (likely(slot != NULL)) {
2510 PyObject *x = slot(coerced1, coerced2);
2512 Py_DECREF(coerced1);
2513 Py_DECREF(coerced2);
2516 goto exit_binary_result_object;
2521 Py_DECREF(coerced1);
2522 Py_DECREF(coerced2);
2526 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2529 PyObject *coerced1 = operand1;
2530 PyObject *coerced2 = operand2;
2532 int err = c2(&coerced2, &coerced1);
2534 if (unlikely(err < 0)) {
2535 goto exit_binary_exception;
2539 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2541 if (likely(mv == NULL)) {
2542 binaryfunc slot = mv->nb_lshift;
2544 if (likely(slot != NULL)) {
2545 PyObject *x = slot(coerced1, coerced2);
2547 Py_DECREF(coerced1);
2548 Py_DECREF(coerced2);
2551 goto exit_binary_result_object;
2556 Py_DECREF(coerced1);
2557 Py_DECREF(coerced2);
2563 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and '%s'", type1->tp_name, type2->tp_name);
2564 goto exit_binary_exception;
2566exit_binary_result_object:
2569exit_binary_exception:
2573PyObject *BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
2574 return _BINARY_OPERATION_LSHIFT_OBJECT_OBJECT_OBJECT(operand1, operand2);
2578static nuitka_bool _BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
2579 CHECK_OBJECT(operand1);
2580 CHECK_OBJECT(operand2);
2582#if PYTHON_VERSION < 0x300
2583 if (PyInt_CheckExact(operand1) && PyInt_CheckExact(operand2)) {
2587#if defined(_MSC_VER)
2588#pragma warning(push)
2589#pragma warning(disable : 4101)
2591 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2592 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2593 NUITKA_MAY_BE_UNUSED
long clong_result;
2594 NUITKA_MAY_BE_UNUSED
double cfloat_result;
2595#if defined(_MSC_VER)
2599 CHECK_OBJECT(operand1);
2600 assert(PyInt_CheckExact(operand1));
2601 CHECK_OBJECT(operand2);
2602 assert(PyInt_CheckExact(operand2));
2604 const long a = PyInt_AS_LONG(operand1);
2605 const long b = PyInt_AS_LONG(operand2);
2607 if (unlikely(b < 0)) {
2608 PyThreadState *tstate = PyThreadState_GET();
2610 SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ValueError,
"negative shift count");
2611 goto exit_result_exception;
2614 if (a == 0 || b == 0) {
2615 goto exit_result_ok_left;
2616 }
else if (b >= LONG_BIT) {
2617 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
2618 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
2621 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
2623 Py_DECREF(operand1_long);
2624 Py_DECREF(operand2_long);
2627 goto exit_result_object;
2631 if (a != Py_ARITHMETIC_RIGHT_SHIFT(
long, c, b)) {
2632 PyObject *operand1_long = Nuitka_PyLong_FromLong(a);
2633 PyObject *operand2_long = Nuitka_PyLong_FromLong(b);
2636 PyObject *r = _BINARY_OPERATION_LSHIFT_OBJECT_LONG_LONG(operand1_long, operand2_long);
2638 Py_DECREF(operand1_long);
2639 Py_DECREF(operand2_long);
2642 goto exit_result_object;
2645 goto exit_result_ok_clong;
2649 exit_result_ok_clong:
2650 result = clong_result != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2651 goto exit_result_ok;
2653 exit_result_ok_left:
2654 result = PyInt_AS_LONG(operand1) != 0 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2655 goto exit_result_ok;
2658 if (unlikely(obj_result == NULL)) {
2659 goto exit_result_exception;
2661 result = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2662 Py_DECREF(obj_result);
2663 goto exit_result_ok;
2668 exit_result_exception:
2669 return NUITKA_BOOL_EXCEPTION;
2673 PyTypeObject *type1 = Py_TYPE(operand1);
2674 PyTypeObject *type2 = Py_TYPE(operand2);
2676#if defined(_MSC_VER)
2677#pragma warning(push)
2678#pragma warning(disable : 4101)
2680 NUITKA_MAY_BE_UNUSED
bool cbool_result;
2681 NUITKA_MAY_BE_UNUSED PyObject *obj_result;
2682#if defined(_MSC_VER)
2687 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_lshift : NULL;
2688 binaryfunc slot2 = NULL;
2690 if (!(type1 == type2)) {
2693 slot2 = (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_lshift : NULL;
2695 if (slot1 == slot2) {
2700 if (slot1 != NULL) {
2701 if (slot2 != NULL) {
2702 if (Nuitka_Type_IsSubtype(type2, type1)) {
2703 PyObject *x = slot2(operand1, operand2);
2705 if (x != Py_NotImplemented) {
2707 goto exit_binary_result_object;
2710 Py_DECREF_IMMORTAL(x);
2715 PyObject *x = slot1(operand1, operand2);
2717 if (x != Py_NotImplemented) {
2719 goto exit_binary_result_object;
2722 Py_DECREF_IMMORTAL(x);
2725 if (slot2 != NULL) {
2726 PyObject *x = slot2(operand1, operand2);
2728 if (x != Py_NotImplemented) {
2730 goto exit_binary_result_object;
2733 Py_DECREF_IMMORTAL(x);
2736#if PYTHON_VERSION < 0x300
2737 if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
2739 (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2742 PyObject *coerced1 = operand1;
2743 PyObject *coerced2 = operand2;
2745 int err = c1(&coerced1, &coerced2);
2747 if (unlikely(err < 0)) {
2748 goto exit_binary_exception;
2752 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2754 if (likely(mv == NULL)) {
2755 binaryfunc slot = mv->nb_lshift;
2757 if (likely(slot != NULL)) {
2758 PyObject *x = slot(coerced1, coerced2);
2760 Py_DECREF(coerced1);
2761 Py_DECREF(coerced2);
2764 goto exit_binary_result_object;
2769 Py_DECREF(coerced1);
2770 Py_DECREF(coerced2);
2774 (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2777 PyObject *coerced1 = operand1;
2778 PyObject *coerced2 = operand2;
2780 int err = c2(&coerced2, &coerced1);
2782 if (unlikely(err < 0)) {
2783 goto exit_binary_exception;
2787 PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2789 if (likely(mv == NULL)) {
2790 binaryfunc slot = mv->nb_lshift;
2792 if (likely(slot != NULL)) {
2793 PyObject *x = slot(coerced1, coerced2);
2795 Py_DECREF(coerced1);
2796 Py_DECREF(coerced2);
2799 goto exit_binary_result_object;
2804 Py_DECREF(coerced1);
2805 Py_DECREF(coerced2);
2811 PyErr_Format(PyExc_TypeError,
"unsupported operand type(s) for <<: '%s' and '%s'", type1->tp_name, type2->tp_name);
2812 goto exit_binary_exception;
2814exit_binary_result_object:
2815 if (unlikely(obj_result == NULL)) {
2816 return NUITKA_BOOL_EXCEPTION;
2820 nuitka_bool r = CHECK_IF_TRUE(obj_result) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
2821 Py_DECREF(obj_result);
2825exit_binary_exception:
2826 return NUITKA_BOOL_EXCEPTION;
2829nuitka_bool BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_OBJECT(PyObject *operand1, PyObject *operand2) {
2830 return _BINARY_OPERATION_LSHIFT_NBOOL_OBJECT_OBJECT(operand1, operand2);