Fix P256 corner cases (#5218)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Ernesto García <ernestognw@gmail.com>
This commit is contained in:
cairo
2024-09-30 09:05:44 -07:00
committed by GitHub
parent d3ca1d1f00
commit e3cfe1c5dd
4 changed files with 88 additions and 30 deletions

View File

@ -13,11 +13,11 @@ module.exports = {
// Range from start to end in increment
// Example: range(17,42,7) → [17,24,31,38]
range: (start, stop = undefined, step = 1) => {
if (!stop) {
if (stop == undefined) {
stop = start;
start = 0;
}
return start < stop ? Array.from({ length: Math.ceil((stop - start) / step) }, (_, i) => start + i * step) : [];
return start < stop ? Array.from({ length: (stop - start + step - 1) / step }, (_, i) => start + i * step) : [];
},
// Unique elements, with an optional getter function