X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=folly%2FPackedSyncPtr.h;h=f6c87adff47c4481299973e2048606897a3f3cca;hb=4bfbe0a10e914c3626e16cfdb9e87508e63b065f;hp=e11588e8419540a32f5ff80e38749253c1f134b1;hpb=7e04d47528f4ac428741ec41efdc500fb515e4ac;p=folly.git diff --git a/folly/PackedSyncPtr.h b/folly/PackedSyncPtr.h index e11588e8..f6c87adf 100644 --- a/folly/PackedSyncPtr.h +++ b/folly/PackedSyncPtr.h @@ -1,5 +1,5 @@ /* - * Copyright 2017 Facebook, Inc. + * Copyright 2011-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,15 @@ #pragma once +#include + +#include + #include +#include -#if !FOLLY_X64 && !FOLLY_PPC64 && !FOLLY_A64 -# error "PackedSyncPtr is x64, ppc64 or aarch64 specific code." +#if !FOLLY_X64 && !FOLLY_PPC64 && !FOLLY_AARCH64 +#error "PackedSyncPtr is x64, ppc64 or aarch64 specific code." #endif /* @@ -52,20 +57,16 @@ * @author Jordan DeLong */ -#include -#include -#include - namespace folly { -template +template class PackedSyncPtr { // This just allows using this class even with T=void. Attempting // to use the operator* or operator[] on a PackedSyncPtr will // still properly result in a compile error. typedef typename std::add_lvalue_reference::type reference; -public: + public: /* * If you default construct one of these, you must call this init() * function before using it. @@ -73,7 +74,7 @@ public: * (We are avoiding a constructor to ensure gcc allows us to put * this class in packed structures.) */ - void init(T* initialPtr = 0, uint16_t initialExtra = 0) { + void init(T* initialPtr = nullptr, uint16_t initialExtra = 0) { auto intPtr = reinterpret_cast(initialPtr); CHECK(!(intPtr >> 48)); data_.init(intPtr); @@ -149,4 +150,4 @@ std::ostream& operator<<(std::ostream& os, const PackedSyncPtr& ptr) { os << "PackedSyncPtr(" << ptr.get() << ", " << ptr.extra() << ")"; return os; } -} +} // namespace folly