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