This commit is contained in:
blueloveTH 2024-03-17 18:06:38 +08:00
parent 92f9b93245
commit 3aea1647d0
2 changed files with 3 additions and 3 deletions

View File

@ -180,7 +180,7 @@ struct Type {
#define PK_ASSERT(x) if(!(x)) PK_FATAL_ERROR(); #define PK_ASSERT(x) if(!(x)) PK_FATAL_ERROR();
struct PyObject; struct PyObject;
#define PK_BITS(p) (reinterpret_cast<Number::int_t>(p)) #define PK_BITS(p) (reinterpret_cast<i64>(p))
#define PK_SMALL_INT(val) (reinterpret_cast<PyObject*>(val << 2 | 0b10)) #define PK_SMALL_INT(val) (reinterpret_cast<PyObject*>(val << 2 | 0b10))
inline PyObject* tag_float(f64 val){ inline PyObject* tag_float(f64 val){

View File

@ -4,14 +4,14 @@ namespace pkpy{
#define PREDICT_INT_OP(op) \ #define PREDICT_INT_OP(op) \
if(is_small_int(_0) && is_small_int(_1)){ \ if(is_small_int(_0) && is_small_int(_1)){ \
TOP() = VAR((i64)(PK_BITS(_0)>>2) op (i64)(PK_BITS(_1)>>2)); \ TOP() = VAR((PK_BITS(_0)>>2) op (PK_BITS(_1)>>2)); \
DISPATCH() \ DISPATCH() \
} }
#define PREDICT_INT_DIV_OP(op) \ #define PREDICT_INT_DIV_OP(op) \
if(is_small_int(_0) && is_small_int(_1)){ \ if(is_small_int(_0) && is_small_int(_1)){ \
if(_1 == PK_SMALL_INT(0)) ZeroDivisionError(); \ if(_1 == PK_SMALL_INT(0)) ZeroDivisionError(); \
TOP() = VAR((i64)(PK_BITS(_0)>>2) op (i64)(PK_BITS(_1)>>2)); \ TOP() = VAR((PK_BITS(_0)>>2) op (PK_BITS(_1)>>2)); \
DISPATCH() \ DISPATCH() \
} }