mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 00:10:27 +00:00
Remove range check on 32 bit arch since it will always pass.
This commit is contained in:
parent
7248626235
commit
b738319f8d
@ -699,11 +699,15 @@ Janet janet_lengthv(Janet x) {
|
|||||||
if (type->length != NULL) {
|
if (type->length != NULL) {
|
||||||
size_t len = type->length(abst, janet_abstract_size(abst));
|
size_t len = type->length(abst, janet_abstract_size(abst));
|
||||||
/* If len is always less then double, we can never overflow */
|
/* 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)) {
|
#ifdef JANET_32
|
||||||
return janet_wrap_number((double) len);
|
return janet_wrap_number(len);
|
||||||
|
#else
|
||||||
|
if (len < (size_t) JANET_INTMAX_INT64) {
|
||||||
|
return janet_wrap_number(len);
|
||||||
} else {
|
} else {
|
||||||
janet_panicf("integer length %u too large", len);
|
janet_panicf("integer length %u too large", len);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
Janet argv[1] = { x };
|
Janet argv[1] = { x };
|
||||||
return janet_mcall("length", 1, argv);
|
return janet_mcall("length", 1, argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user