on master help sign in
Fix getSlot while
commita40ee9a92d27011a6328bd77f7c0dce28d7d0a13 authorChristian Widera <xash@posteo.de> dateWed 23 Apr 2014, 13:41 (13 years ago) parenta969e0d
1 file changed+2−2
libraries/Native/Array.js+2−2
libraries/Native/Array.js+2−2
@@ -37,7 +37,7 @@ Elm.Native.Array.make = function(elm) {
3737 for (var x = array.height; x > 0; x--) {
3838 var slot = i >> (x * 5);
3939 if (slot > 0) {
40− while (array.lengths[slot - 1] > i) { slot--; }
40+ while (array.lengths[slot - 1] >= i) { slot--; }
4141 i -= array.lengths[slot - 1];
4242 }
4343 array = array.table[slot];
@@ -542,7 +542,7 @@ Elm.Native.Array.make = function(elm) {
542542 // find the exact slot via forward searching in "lengths". Returns the index.
543543 function getSlot(i, a) {
544544 var slot = i >> (5 * a.height);
545− while (a.lengths[slot - 1] > i) { slot--; }
545+ while (a.lengths[slot - 1] >= i) { slot--; }
546546 return slot;
547547 }
548548