mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-09 21:20:17 +00:00
Update pocketpy.cpp
This commit is contained in:
parent
6486a497a9
commit
e3a8d05ba6
@ -444,8 +444,8 @@ void init_builtins(VM* _vm) {
|
||||
return VAR(_CAST(i64, _0) % rhs);
|
||||
});
|
||||
|
||||
_vm->bind(_vm->_t(VM::tp_int), "bit_length(self)", [](VM* vm, ArgsView args) {
|
||||
i64 x = CAST(i64, args[0]);
|
||||
_vm->bind_method<0>(VM::tp_int, "bit_length", [](VM* vm, ArgsView args) {
|
||||
i64 x = _CAST(i64, args[0]);
|
||||
if(x < 0) x = -x;
|
||||
int bits = 0;
|
||||
while(x){ x >>= 1; bits++; }
|
||||
@ -1633,4 +1633,4 @@ CodeObject_ VM::compile(std::string_view source, const Str& filename, CompileMod
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pkpy
|
||||
} // namespace pkpy
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user