Remove range check on 32 bit arch since it will always pass.

This commit is contained in:
Calvin Rose 2023-06-24 11:17:30 -05:00
parent 7248626235
commit b738319f8d
1 changed files with 6 additions and 2 deletions

View File

@ -699,11 +699,15 @@ Janet janet_lengthv(Janet x) {
if (type->length != NULL) {
size_t len = type->length(abst, janet_abstract_size(abst));
/* If len is always less then double, we can never overflow */
if (((int64_t) SIZE_MAX <= JANET_INTMAX_INT64) || (len < (size_t) JANET_INTMAX_INT64)) {
return janet_wrap_number((double) len);
#ifdef JANET_32
return janet_wrap_number(len);
#else
if (len < (size_t) JANET_INTMAX_INT64) {
return janet_wrap_number(len);
} else {
janet_panicf("integer length %u too large", len);
}
#endif
}
Janet argv[1] = { x };
return janet_mcall("length", 1, argv);