Commit ddd6f454 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a7b82699
...@@ -102,6 +102,11 @@ type BucketEntry struct { ...@@ -102,6 +102,11 @@ type BucketEntry struct {
value interface{} value interface{}
} }
// KeyRange represents [lo,hi) key range.
type KeyRange struct {
Lo KEY
Hi_ KEY // NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
const _KeyMin KEY = math.Min<Key> const _KeyMin KEY = math.Min<Key>
const _KeyMax KEY = math.Max<Key> const _KeyMax KEY = math.Max<Key>
...@@ -694,12 +699,7 @@ func init() { ...@@ -694,12 +699,7 @@ func init() {
} }
// XXX place // ---- misc ----
// KeyRange represents [lo,hi) key range.
type KeyRange struct {
Lo KEY
Hi_ KEY // NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
// Has returns whether key k belongs to the range. // Has returns whether key k belongs to the range.
func (r *KeyRange) Has(k KEY) bool { func (r *KeyRange) Has(k KEY) bool {
...@@ -728,7 +728,6 @@ func (r KeyRange) String() string { ...@@ -728,7 +728,6 @@ func (r KeyRange) String() string {
} }
// XXX place
func kmin(a, b KEY) KEY { func kmin(a, b KEY) KEY {
if a < b { if a < b {
return a return a
......
...@@ -104,6 +104,11 @@ type IOBucketEntry struct { ...@@ -104,6 +104,11 @@ type IOBucketEntry struct {
value interface{} value interface{}
} }
// IKeyRange represents [lo,hi) key range.
type IKeyRange struct {
Lo int32
Hi_ int32 // NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
const _IKeyMin int32 = math.MinInt32 const _IKeyMin int32 = math.MinInt32
const _IKeyMax int32 = math.MaxInt32 const _IKeyMax int32 = math.MaxInt32
...@@ -696,12 +701,7 @@ func init() { ...@@ -696,12 +701,7 @@ func init() {
} }
// XXX place // ---- misc ----
// IKeyRange represents [lo,hi) key range.
type IKeyRange struct {
Lo int32
Hi_ int32 // NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
// Has returns whether key k belongs to the range. // Has returns whether key k belongs to the range.
func (r *IKeyRange) Has(k int32) bool { func (r *IKeyRange) Has(k int32) bool {
...@@ -730,7 +730,6 @@ func (r IKeyRange) String() string { ...@@ -730,7 +730,6 @@ func (r IKeyRange) String() string {
} }
// XXX place
func ikmin(a, b int32) int32 { func ikmin(a, b int32) int32 {
if a < b { if a < b {
return a return a
......
...@@ -104,6 +104,11 @@ type LOBucketEntry struct { ...@@ -104,6 +104,11 @@ type LOBucketEntry struct {
value interface{} value interface{}
} }
// LKeyRange represents [lo,hi) key range.
type LKeyRange struct {
Lo int64
Hi_ int64 // NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
const _LKeyMin int64 = math.MinInt64 const _LKeyMin int64 = math.MinInt64
const _LKeyMax int64 = math.MaxInt64 const _LKeyMax int64 = math.MaxInt64
...@@ -696,12 +701,7 @@ func init() { ...@@ -696,12 +701,7 @@ func init() {
} }
// XXX place // ---- misc ----
// LKeyRange represents [lo,hi) key range.
type LKeyRange struct {
Lo int64
Hi_ int64 // NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
// Has returns whether key k belongs to the range. // Has returns whether key k belongs to the range.
func (r *LKeyRange) Has(k int64) bool { func (r *LKeyRange) Has(k int64) bool {
...@@ -730,7 +730,6 @@ func (r LKeyRange) String() string { ...@@ -730,7 +730,6 @@ func (r LKeyRange) String() string {
} }
// XXX place
func lkmin(a, b int64) int64 { func lkmin(a, b int64) int64 {
if a < b { if a < b {
return a return a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment