]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/util/aligned_buffer.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / util / aligned_buffer.h
index 7098322f82064fcedc4fe18292eb87cdea8a16db..95ee5dfe82e818a855889b0ee14f8e0385d106b1 100644 (file)
@@ -9,6 +9,7 @@
 #pragma once
 
 #include <algorithm>
+
 #include "port/port.h"
 
 namespace ROCKSDB_NAMESPACE {
@@ -30,9 +31,7 @@ inline size_t TruncateToPageBoundary(size_t page_size, size_t s) {
 // Example:
 //   Roundup(13, 5)   => 15
 //   Roundup(201, 16) => 208
-inline size_t Roundup(size_t x, size_t y) {
-  return ((x + y - 1) / y) * y;
-}
+inline size_t Roundup(size_t x, size_t y) { return ((x + y - 1) / y) * y; }
 
 // Round down x to a multiple of y.
 // Example:
@@ -61,19 +60,13 @@ class AlignedBuffer {
   size_t cursize_;
   char* bufstart_;
 
-public:
+ public:
   AlignedBuffer()
-    : alignment_(),
-      capacity_(0),
-      cursize_(0),
-      bufstart_(nullptr) {
-  }
+      : alignment_(), capacity_(0), cursize_(0), bufstart_(nullptr) {}
 
-  AlignedBuffer(AlignedBuffer&& o) ROCKSDB_NOEXCEPT {
-    *this = std::move(o);
-  }
+  AlignedBuffer(AlignedBuffer&& o) noexcept { *this = std::move(o); }
 
-  AlignedBuffer& operator=(AlignedBuffer&& o) ROCKSDB_NOEXCEPT {
+  AlignedBuffer& operator=(AlignedBuffer&& o) noexcept {
     alignment_ = std::move(o.alignment_);
     buf_ = std::move(o.buf_);
     capacity_ = std::move(o.capacity_);
@@ -94,27 +87,17 @@ public:
     return n % alignment == 0;
   }
 
-  size_t Alignment() const {
-    return alignment_;
-  }
+  size_t Alignment() const { return alignment_; }
 
-  size_t Capacity() const {
-    return capacity_;
-  }
+  size_t Capacity() const { return capacity_; }
 
-  size_t CurrentSize() const {
-    return cursize_;
-  }
+  size_t CurrentSize() const { return cursize_; }
 
-  const char* BufferStart() const {
-    return bufstart_;
-  }
+  const char* BufferStart() const { return bufstart_; }
 
   char* BufferStart() { return bufstart_; }
 
-  void Clear() {
-    cursize_ = 0;
-  }
+  void Clear() { cursize_ = 0; }
 
   char* Release() {
     cursize_ = 0;
@@ -204,7 +187,7 @@ public:
     assert(offset < cursize_);
 
     size_t to_read = 0;
-    if(offset < cursize_) {
+    if (offset < cursize_) {
       to_read = std::min(cursize_ - offset, read_size);
     }
     if (to_read > 0) {
@@ -244,12 +227,8 @@ public:
   // the buffer is modified without using the write APIs or encapsulation
   // offered by AlignedBuffer. It is up to the user to guard against such
   // errors.
-  char* Destination() {
-    return bufstart_ + cursize_;
-  }
+  char* Destination() { return bufstart_ + cursize_; }
 
-  void Size(size_t cursize) {
-    cursize_ = cursize;
-  }
+  void Size(size_t cursize) { cursize_ = cursize; }
 };
 }  // namespace ROCKSDB_NAMESPACE