]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/utilities/cassandra/serialize.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / utilities / cassandra / serialize.h
index cd980ade0f687a7e898bec21fb980775e02f6b1d..4bd552bfc1fdbf26d26ce9476601f198d6db940a 100644 (file)
 
 #pragma once
 
+#include <cstdint>
+#include <string>
+
+#include "rocksdb/rocksdb_namespace.h"
+
 namespace ROCKSDB_NAMESPACE {
 namespace cassandra {
 namespace {
 const int64_t kCharMask = 0xFFLL;
 const int32_t kBitsPerByte = 8;
-}
+}  // namespace
 
-template<typename T>
+template <typename T>
 void Serialize(T val, std::string* dest);
 
-template<typename T>
-T Deserialize(const char* src, std::size_t offset=0);
+template <typename T>
+T Deserialize(const char* src, std::size_t offset = 0);
 
 // Specializations
-template<>
+template <>
 inline void Serialize<int8_t>(int8_t t, std::string* dest) {
   dest->append(1, static_cast<char>(t & kCharMask));
 }
 
-template<>
+template <>
 inline void Serialize<int32_t>(int32_t t, std::string* dest) {
   for (unsigned long i = 0; i < sizeof(int32_t); i++) {
-     dest->append(1, static_cast<char>(
-       (t >> (sizeof(int32_t) - 1 - i) * kBitsPerByte) & kCharMask));
+    dest->append(
+        1, static_cast<char>((t >> (sizeof(int32_t) - 1 - i) * kBitsPerByte) &
+                             kCharMask));
   }
 }
 
-template<>
+template <>
 inline void Serialize<int64_t>(int64_t t, std::string* dest) {
   for (unsigned long i = 0; i < sizeof(int64_t); i++) {
-     dest->append(
-       1, static_cast<char>(
-         (t >> (sizeof(int64_t) - 1 - i) * kBitsPerByte) & kCharMask));
+    dest->append(
+        1, static_cast<char>((t >> (sizeof(int64_t) - 1 - i) * kBitsPerByte) &
+                             kCharMask));
   }
 }
 
-template<>
+template <>
 inline int8_t Deserialize<int8_t>(const char* src, std::size_t offset) {
   return static_cast<int8_t>(src[offset]);
 }
 
-template<>
+template <>
 inline int32_t Deserialize<int32_t>(const char* src, std::size_t offset) {
   int32_t result = 0;
   for (unsigned long i = 0; i < sizeof(int32_t); i++) {
     result |= static_cast<int32_t>(static_cast<unsigned char>(src[offset + i]))
-        << ((sizeof(int32_t) - 1 - i) * kBitsPerByte);
+              << ((sizeof(int32_t) - 1 - i) * kBitsPerByte);
   }
   return result;
 }
 
-template<>
+template <>
 inline int64_t Deserialize<int64_t>(const char* src, std::size_t offset) {
   int64_t result = 0;
   for (unsigned long i = 0; i < sizeof(int64_t); i++) {
     result |= static_cast<int64_t>(static_cast<unsigned char>(src[offset + i]))
-        << ((sizeof(int64_t) - 1 - i) * kBitsPerByte);
+              << ((sizeof(int64_t) - 1 - i) * kBitsPerByte);
   }
   return result;
 }
 
-} // namepsace cassandrda
+}  // namespace cassandra
 }  // namespace ROCKSDB_NAMESPACE