|
@@ -263,15 +263,25 @@ class valtokey
|
|
|
|
|
|
public function findless($val,$start,$length)
|
|
|
{
|
|
|
- $pos = algorithm::upper_bound($this->mValMap,$val);
|
|
|
- $pos = $pos - $start;
|
|
|
+ $pos = algorithm::lower_bonud($this->mValMap,$val);
|
|
|
if($pos < 0) {
|
|
|
return false;
|
|
|
}
|
|
|
elseif ($pos >= $this->mCount) {
|
|
|
$pos = $this->mCount - 1;
|
|
|
}
|
|
|
+ else {
|
|
|
+ $data = $this->mValMap[$pos];
|
|
|
+ if($data > $val) {
|
|
|
+ $pos -= 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ $pos = $pos - $start;
|
|
|
+ if($pos < 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
$result = [];
|
|
|
for ($i = $pos; $i >= 0 && $length > 0; $i--,$length--) {
|
|
|
$result[] = $this->mKeys[$i];
|