Skip to content

Commit 406c564

Browse files
committed
BIFs: erlang:is_function/2 use new term_is_any_non_neg_integer
Start moving existing code to predicates such as `term_is_any_non_neg_integer(t)`. Signed-off-by: Davide Bettio <davide@uninstall.it>
1 parent d16b5af commit 406c564

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/libAtomVM/bif.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,14 @@ term bif_erlang_is_function_1(Context *ctx, uint32_t fail_label, term arg1)
181181

182182
term bif_erlang_is_function_2(Context *ctx, uint32_t fail_label, term arg1, term arg2)
183183
{
184-
VALIDATE_VALUE_BIF(fail_label, arg2, term_is_any_integer);
184+
VALIDATE_VALUE_BIF(fail_label, arg2, term_is_any_non_neg_integer);
185185

186186
if (!term_is_integer(arg2)) {
187187
// function takes any positive integer, including big integers
188188
// but internally we use only small integers
189189
return FALSE_ATOM;
190190
}
191191
avm_int_t arity = term_to_int(arg2);
192-
if (arity < 0) {
193-
RAISE_ERROR_BIF(fail_label, BADARG_ATOM);
194-
}
195192

196193
if (!term_is_function(arg1)) {
197194
return FALSE_ATOM;

0 commit comments

Comments
 (0)