From b738319f8d4037dba639da1a310b52a441e4ba34 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 24 Jun 2023 11:17:30 -0500 Subject: [PATCH] Remove range check on 32 bit arch since it will always pass. --- src/core/value.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/value.c b/src/core/value.c index 8a2c3bfa..3a071cda 100644 --- a/src/core/value.c +++ b/src/core/value.c @@ -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);