mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 05:21:38 +02:00
Horner's method
This commit is contained in:
@@ -8,6 +8,6 @@ function _str_hash(value) =
|
|||||||
cum_total = [
|
cum_total = [
|
||||||
for(i = 0, s = ord(chars[0]), is_continue = i < end;
|
for(i = 0, s = ord(chars[0]), is_continue = i < end;
|
||||||
is_continue;
|
is_continue;
|
||||||
i = i + 1, is_continue = i < end, s = is_continue ? s + (ord(chars[i]) * 31 ^ i) : undef) s]
|
i = i + 1, is_continue = i < end, s = is_continue ? 31 * s + ord(chars[i]) : undef) s]
|
||||||
)
|
)
|
||||||
cum_total[end - 1] + (ord(chars[end]) * 31 ^ end);
|
31 * cum_total[end - 1] + ord(chars[end]);
|
Reference in New Issue
Block a user