Commit 086f80ae authored by Stefan Behnel's avatar Stefan Behnel

Fix enum-to-unicode conversion code in C++ mode where direct assignments from...

Fix enum-to-unicode conversion code in C++ mode where direct assignments from C int to enum are not allowed.
parent 5e74a930
...@@ -698,21 +698,21 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t wid ...@@ -698,21 +698,21 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t wid
switch (format_char) { switch (format_char) {
case 'o': case 'o':
digit_pos = abs((int)(remaining % (8*8))); digit_pos = abs((int)(remaining % (8*8)));
remaining = remaining / (8*8); remaining = ({{TYPE}}) (remaining / (8*8));
dpos -= 2; dpos -= 2;
*(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_8)[digit_pos]; /* copy 2 digits at a time */ *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_8)[digit_pos]; /* copy 2 digits at a time */
last_one_off = (digit_pos < 8); last_one_off = (digit_pos < 8);
break; break;
case 'd': case 'd':
digit_pos = abs((int)(remaining % (10*10))); digit_pos = abs((int)(remaining % (10*10)));
remaining = remaining / (10*10); remaining = ({{TYPE}}) (remaining / (10*10));
dpos -= 2; dpos -= 2;
*(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_10)[digit_pos]; /* copy 2 digits at a time */ *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_10)[digit_pos]; /* copy 2 digits at a time */
last_one_off = (digit_pos < 10); last_one_off = (digit_pos < 10);
break; break;
case 'x': case 'x':
*(--dpos) = hex_digits[abs((int)(remaining % 16))]; *(--dpos) = hex_digits[abs((int)(remaining % 16))];
remaining = remaining / 16; remaining = ({{TYPE}}) (remaining / 16);
break; break;
default: default:
assert(0); assert(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment