on master help sign in
Fix getSlot
a05e576Christian Widera
libraries/Native/Array.js+2−4
@@ -539,10 +539,8 @@ Elm.Native.Array.make = function(elm) {
539 // Calculates in which slot of "table" the item probably is, then
539 // Calculates in which slot of "table" the item probably is, then
540 // find the exact slot via forward searching in "lengths". Returns the index.
540 // find the exact slot via forward searching in "lengths". Returns the index.
541 function getSlot(i, a) {
541 function getSlot(i, a) {
542− var slot = i << (5 * a.height);
542+ var slot = i >> (5 * a.height);
543− while (a.lengths[slot - 1] > i) {
543+ while (a.lengths[slot - 1] > i) { slot--; }
544− slot++;
545− }
546 return slot;
544 return slot;
547 }
545 }
548
546