Seems like this might be a bug in Cython. The corresponding line in test.cequals
__pyx_t_2 = __Pyx_PyInt_From_unsigned_int((-(__pyx_t_1 & __pyx_v_4test_c)));
Clearly interpreting our number as unsigned gives the wrong answer. However, if I delete the call abs, then I get
__pyx_t_1 = __Pyx_PyInt_From_int((-(__pyx_v_4test_b & __pyx_v_4test_c)));
and the result is correct. If I add cast to int as print('%d'%(-(<int>abs(b)&c))), then I will also get the correct answer.
Crossroads placed on Cython github page
: github:
, int , abs (-MAX_INT-1), . , , , , . , ...