Merge pull request #14438 from s-hadinger/berry_int_comptr

Berry int() converts comptr
This commit is contained in:
s-hadinger 2022-01-14 17:53:23 +01:00 committed by GitHub
commit 878d4df560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -233,6 +233,9 @@ static int l_int(bvm *vm)
be_pushvalue(vm, 1);
} else if (be_isbool(vm, 1)) {
be_pushint(vm, be_tobool(vm, 1) ? 1 : 0);
} else if (be_iscomptr(vm, 1)) {
intptr_t p = (intptr_t) be_tocomptr(vm, 1);
be_pushint(vm, (int) p);
} else {
be_return_nil(vm);
}