function | since v0.0-2261 | Edit |
(m3-hash-unencoded-chars in)
(defn ^number m3-hash-unencoded-chars [in]
(let [h1 (loop [i 1 h1 m3-seed]
(if (< i (.-length in))
(recur (+ i 2)
(m3-mix-H1 h1
(m3-mix-K1
(bit-or (.charCodeAt in (dec i))
(bit-shift-left (.charCodeAt in i) 16)))))
h1))
h1 (if (== (bit-and (.-length in) 1) 1)
(bit-xor h1 (m3-mix-K1 (.charCodeAt in (dec (.-length in)))))
h1)]
(m3-fmix h1 (imul 2 (.-length in)))))