/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
size = roundUp(size);
bytesUsed_ += size;
- if (LIKELY(end_ - ptr_ >= size)) {
+ assert(ptr_ <= end_);
+ if (LIKELY((size_t)(end_ - ptr_) >= size)) {
// Fast path: there's enough room in the current block
char* r = ptr_;
ptr_ += size;
return bytesUsed_;
}
- private:
// not copyable
Arena(const Arena&) = delete;
Arena& operator=(const Arena&) = delete;
Arena(Arena&&) = default;
Arena& operator=(Arena&&) = default;
+ private:
struct Block;
typedef boost::intrusive::slist_member_hook<
boost::intrusive::tag<Arena>> BlockLink;
}
private:
- Block() { }
- ~Block() { }
+ Block() = default;
+ ~Block() = default;
} __attribute__((__aligned__));
// This should be alignas(std::max_align_t) but neither alignas nor
// max_align_t are supported by gcc 4.6.2.