michael@0: // Generated by CoffeeScript 1.6.1 michael@0: (function() { michael@0: michael@0: window.binary_search = function(items, value) { michael@0: var pivot, start, stop; michael@0: start = 0; michael@0: stop = items.length - 1; michael@0: pivot = Math.floor((start + stop) / 2); michael@0: while (items[pivot] !== value && start < stop) { michael@0: if (value < items[pivot]) { michael@0: stop = pivot - 1; michael@0: } michael@0: if (value > items[pivot]) { michael@0: start = pivot + 1; michael@0: } michael@0: pivot = Math.floor((stop + start) / 2); michael@0: } michael@0: if (items[pivot] === value) { michael@0: return pivot; michael@0: } else { michael@0: return -1; michael@0: } michael@0: }; michael@0: michael@0: }).call(this); michael@0: michael@0: /* michael@0: //# sourceMappingURL=code_binary_search.map michael@0: */