1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-18 04:21:16 +02:00

Horner's method

This commit is contained in:
Justin Lin
2022-04-06 14:27:57 +08:00
parent 029ddc4150
commit eeaa9b3b2f

View File

@@ -8,6 +8,6 @@ function _str_hash(value) =
cum_total = [
for(i = 0, s = ord(chars[0]), is_continue = i < end;
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]);