Skip to content

Commit 1890739

Browse files
committed
support compact ints
1 parent 92e6c4b commit 1890739

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

Python/optimizer_bytecodes.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,16 @@ dummy_func(void) {
448448
}
449449

450450
op(_UNARY_NEGATIVE, (value -- res)) {
451-
PyTypeObject *type = sym_get_type(value);
452-
if (type == &PyLong_Type || type == &PyFloat_Type) {
453-
res = sym_new_type(ctx, type);
454-
}
455-
else {
456-
res = sym_new_not_null(ctx);
451+
if (sym_is_compact_int(value)) {
452+
res = sym_new_compact_int(ctx);
453+
} else {
454+
PyTypeObject *type = sym_get_type(value);
455+
if (type == &PyLong_Type || type == &PyFloat_Type) {
456+
res = sym_new_type(ctx, type);
457+
}
458+
else {
459+
res = sym_new_not_null(ctx);
460+
}
457461
}
458462
}
459463

Python/optimizer_cases.c.h

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)