export function bsearch < T > ( array , value , start = 0 , end = array . length ) { let _start = start ; let _end = end ; while ( _start < _end ) { const mid = ( _start + _end ) >> 1 ; if ( array [ mid ] < value ) { _start = mid + 1 ; } else { _end = mid ; } } return _start ; }