Improve MemoryLog buffer size checks.
GitOrigin-RevId: f7f270f7e2587aadb5d682aca4c7279dd27d770f
This commit is contained in:
parent
37e87bddf5
commit
d6b2fc0e17
@ -19,7 +19,9 @@ namespace td {
|
||||
template <int buffer_size = 32 * (1 << 10)>
|
||||
class MemoryLog : public LogInterface {
|
||||
static constexpr size_t MAX_OUTPUT_SIZE = buffer_size / 16 < (8 << 10) ? buffer_size / 16 : (8 << 10);
|
||||
static_assert((buffer_size & 15) == 0 && buffer_size >= (8 << 10), "Invalid buffer size");
|
||||
|
||||
static_assert((buffer_size & (buffer_size - 1)) == 0, "Buffer size must be power of 2");
|
||||
static_assert(buffer_size >= (8 << 10), "Too small buffer size");
|
||||
|
||||
public:
|
||||
MemoryLog() {
|
||||
|
Loading…
Reference in New Issue
Block a user