Skip to content

Commit

Permalink
Accept floats in things that use krk_long_to_int
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Feb 24, 2024
1 parent 32bd212 commit f1d7bda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/obj_long.c
Expand Up @@ -2382,6 +2382,13 @@ int krk_long_to_int(KrkValue val, char size, void * out) {
accum ^= 0xFFFFffffFFFFffff;
}
}
#ifndef KRK_NO_FLOAT
} else if (IS_FLOATING(val)) {
krk_push(krk_int_from_float(AS_FLOATING(val)));
int res = krk_long_to_int(krk_peek(0), size, out);
krk_pop();
return res;
#endif
} else {
krk_runtimeError(vm.exceptions->typeError, "expected %s, not '%T'", "int", val);
return 0;
Expand Down

0 comments on commit f1d7bda

Please sign in to comment.