index.js
function find(b, ptr, target, level, compare, gt) {
  level = level || r_levels(b, ptr)
  compare = compare || _compare
  gt = gt !== false
  var prev_ptr = 0
  while(true) {
    if(level < 0) break;
    //if this level is last item
    var next_ptr = r_level(b, ptr, level)
    if(next_ptr === 0)
      level --
    else {
      var cmp = compare(r_value(b, next_ptr), target, b)
      if(gt ? cmp > 0 : cmp >= 0)
        level --
      else {
        prev_ptr = ptr
        ptr = next_ptr
      }
    }
  }

  return ptr //gt ? ptr : prev_ptr
}
function find(b, ptr, target, level, compare, gt) {
  level = level || r_levels(b, ptr)
  compare = compare || _compare
  gt = gt !== false
  var prev_ptr = 0
  while(true) {
    if(level < 0) break;
    //if this level is last item
    var next_ptr = r_level(b, ptr, level)
    if(next_ptr === 0)
      level --
    else {
      var cmp = compare(r_value(b, next_ptr), target, b)
      if(gt ? cmp > 0 : cmp >= 0)
        level --
      else {
        prev_ptr = ptr
        ptr = next_ptr
      }
    }
  }

  return ptr //gt ? ptr : prev_ptr
}
/*
ranges

cmp > 0 // get last equal element
cmp >= 0 // get last smaller element
to get first gt element, use find(>) + 1?