Commit 69e84f4f authored by Steve O'Brien's avatar Steve O'Brien Committed by Facebook Github Bot

folly: Range.h: avoid glog macros

Summary:
The `glog/logging.h` header is a bit expensive here considering its size, and how frequently `Range.h` is used.

Replace the `DCHECK_${comparison}` macro usage with macros defined in this file.

Reviewed By: yfeldblum

Differential Revision: D8473303

fbshipit-source-id: cc2a7e9eabab2c1f83a377de5191f708f1c9f317
parent 50aeaaaa
......@@ -25,7 +25,6 @@
#include <folly/portability/Constexpr.h>
#include <folly/portability/String.h>
#include <glog/logging.h>
#include <algorithm>
#include <array>
#include <cassert>
......@@ -546,12 +545,12 @@ class Range {
}
value_type& operator[](size_t i) {
DCHECK_GT(size(), i);
assert(i < size());
return b_[i];
}
const value_type& operator[](size_t i) const {
DCHECK_GT(size(), i);
assert(i < size());
return b_[i];
}
......@@ -622,17 +621,17 @@ class Range {
// unchecked versions
void uncheckedAdvance(size_type n) {
DCHECK_LE(n, size());
assert(n <= size());
b_ += n;
}
void uncheckedSubtract(size_type n) {
DCHECK_LE(n, size());
assert(n <= size());
e_ -= n;
}
Range uncheckedSubpiece(size_type first, size_type length = npos) const {
DCHECK_LE(first, size());
assert(first <= size());
return Range(b_ + first, std::min(length, size() - first));
}
......
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