diff --git a/roaring/roaring.go b/roaring/roaring.go index 43a74a16c..851b9c007 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -431,7 +431,7 @@ func (b *Bitmap) Size() int { // CountRange returns the number of bits set between [start, end). func (b *Bitmap) CountRange(start, end uint64) (n uint64) { - if roaringParanoia { + if roaringSentinel { if start > end { panic(fmt.Sprintf("counting in range but %v > %v", start, end)) } @@ -494,7 +494,7 @@ func (b *Bitmap) Slice() []uint64 { // SliceRange returns a slice of integers between [start, end). func (b *Bitmap) SliceRange(start, end uint64) []uint64 { - if roaringParanoia { + if roaringSentinel { if start > end { panic(fmt.Sprintf("getting slice in range but %v > %v", start, end)) } @@ -1271,7 +1271,7 @@ func (b *Bitmap) Check() error { // Flip performs a logical negate of the bits in the range [start,end]. func (b *Bitmap) Flip(start, end uint64) *Bitmap { - if roaringParanoia { + if roaringSentinel { if start > end { panic(fmt.Sprintf("flipping in range but %v > %v", start, end)) } diff --git a/roaring/roaring_nop_sentinel.go b/roaring/roaring_nop_sentinel.go new file mode 100644 index 000000000..60aaf991a --- /dev/null +++ b/roaring/roaring_nop_sentinel.go @@ -0,0 +1,19 @@ +// Copyright 2017 Pilosa Corp. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !roaringsentinel + +package roaring + +const roaringSentinel = false \ No newline at end of file diff --git a/roaring/roaring_sentinel.go b/roaring/roaring_sentinel.go new file mode 100644 index 000000000..78e501395 --- /dev/null +++ b/roaring/roaring_sentinel.go @@ -0,0 +1,19 @@ +// Copyright 2017 Pilosa Corp. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build roaringsentinel + +package roaring + +const roaringSentinel = true \ No newline at end of file