lib/util.js
function getRoot(i, list) {
	for (var x = list.height; x > 0; x--) {
		var slot = i >> x * _const.B;
		while (list.sizes[slot] <= i) {
			slot++;
		}
		if (slot > 0) {
			i -= list.sizes[slot - 1];
		}
		list = list[slot];
	}
	return list[i];
}
function getRoot(i, list) {
	for (var x = list.height; x > 0; x--) {
		var slot = i >> x * _const.B;
		while (list.sizes[slot] <= i) {
			slot++;
		}
		if (slot > 0) {
			i -= list.sizes[slot - 1];
		}
		list = list[slot];
	}
	return list[i];
}
function getRoot ( i , list ) { for ( var x = list . height ; x > 0 ; x -- ) { var slot = i >> x * _const . B ; while ( list . sizes [ slot ] <= i ) { slot ++ ; } if ( slot > 0 ) { i -= list . sizes [ slot - 1 ] ; } list = list [ slot ] ; } return list [ i ] ; }
Calculates in which slot the item probably is, then find the exact slot in the sizes. Returns the index.
Calculates in which slot the item probably is then find the exact slot in the sizes . Returns the index .