瀏覽代碼

Used C++ style casts

cburdick 7 年之前
父節點
當前提交
ad47ec5060
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/google/protobuf/arena_impl.h

+ 3 - 3
src/google/protobuf/arena_impl.h

@@ -52,7 +52,7 @@ namespace internal {
 
 inline size_t AlignUpTo8(size_t n) {
   // Align n to next multiple of 8 (from Hacker's Delight, Chapter 3.)
-  return (n + 7) & (size_t)-8;
+  return (n + 7) & static_cast<size_t>(-8);
 }
 
 // This class provides the core Arena memory allocation library. Different
@@ -306,8 +306,8 @@ class PROTOBUF_EXPORT ArenaImpl {
  public:
   // kBlockHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8
   // to protect the invariant that pos is always at a multiple of 8.
-  static const size_t kBlockHeaderSize = (sizeof(Block) + 7) & (size_t)-8;
-  static const size_t kSerialArenaSize = (sizeof(SerialArena) + 7) & (size_t)-8;
+  static const size_t kBlockHeaderSize = (sizeof(Block) + 7) & static_cast<size_t>(-8);
+  static const size_t kSerialArenaSize = (sizeof(SerialArena) + 7) & static_cast<size_t>(-8);
   static_assert(kBlockHeaderSize % 8 == 0,
                 "kBlockHeaderSize must be a multiple of 8.");
   static_assert(kSerialArenaSize % 8 == 0,