mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-10 05:30:16 +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);
|
return VAR(_CAST(i64, _0) % rhs);
|
||||||
});
|
});
|
||||||
|
|
||||||
_vm->bind(_vm->_t(VM::tp_int), "bit_length(self)", [](VM* vm, ArgsView args) {
|
_vm->bind_method<0>(VM::tp_int, "bit_length", [](VM* vm, ArgsView args) {
|
||||||
i64 x = CAST(i64, args[0]);
|
i64 x = _CAST(i64, args[0]);
|
||||||
if(x < 0) x = -x;
|
if(x < 0) x = -x;
|
||||||
int bits = 0;
|
int bits = 0;
|
||||||
while(x){ x >>= 1; bits++; }
|
while(x){ x >>= 1; bits++; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user