mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-24 13:30:18 +00:00
...
This commit is contained in:
parent
cc512a76e3
commit
6d6c2935f4
@ -74,12 +74,18 @@ template <>
|
||||
struct NumberTraits<4> {
|
||||
using int_t = int32_t;
|
||||
using float_t = float;
|
||||
|
||||
static constexpr int_t kMaxSmallInt = (1 << 28) - 1;
|
||||
static constexpr int_t kMinSmallInt = - (1 << 28);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct NumberTraits<8> {
|
||||
using int_t = int64_t;
|
||||
using float_t = double;
|
||||
|
||||
static constexpr int_t kMaxSmallInt = (1ll << 60) - 1;
|
||||
static constexpr int_t kMinSmallInt = - (1ll << 60);
|
||||
};
|
||||
|
||||
using Number = NumberTraits<sizeof(void*)>;
|
||||
|
||||
@ -530,13 +530,10 @@ template<> inline double _py_cast<double>(VM* vm, PyObject* obj){
|
||||
return py_cast<double>(vm, obj);
|
||||
}
|
||||
|
||||
const i64 kMaxSmallInt = (1ll << 28) - 1;
|
||||
const i64 kMinSmallInt = -(1ll << 28);
|
||||
|
||||
#define PY_VAR_INT(T) \
|
||||
inline PyObject* py_var(VM* vm, T _val){ \
|
||||
i64 val = static_cast<i64>(_val); \
|
||||
if(val >= kMinSmallInt && val <= kMaxSmallInt){ \
|
||||
if(val >= Number::kMinSmallInt && val <= Number::kMaxSmallInt){ \
|
||||
val = (val << 2) | 0b10; \
|
||||
return reinterpret_cast<PyObject*>(val); \
|
||||
}else{ \
|
||||
|
||||
@ -627,7 +627,6 @@ __NEXT_STEP:;
|
||||
frame->f_globals().set(name, value);
|
||||
}
|
||||
}
|
||||
frame->f_globals()._try_perfect_rehash();
|
||||
} DISPATCH();
|
||||
/*****************************************/
|
||||
TARGET(UNPACK_SEQUENCE){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user