From cd78bcce9961cad0fb9750a81fd9f2f4a05a0ead Mon Sep 17 00:00:00 2001 From: Levi McCallum Date: Mon, 30 Nov 2015 06:53:50 -0800 Subject: [PATCH] Convert naming of hash helpers to AS namespace --- AsyncDisplayKit/ASEqualityHashHelpers.mm | 6 ++--- .../TextKit/ASEqualityHashHelpers.h | 24 +++++++++---------- .../TextKit/ASTextKitAttributes.mm | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/AsyncDisplayKit/ASEqualityHashHelpers.mm b/AsyncDisplayKit/ASEqualityHashHelpers.mm index 739c8dcc66..ca159fc980 100644 --- a/AsyncDisplayKit/ASEqualityHashHelpers.mm +++ b/AsyncDisplayKit/ASEqualityHashHelpers.mm @@ -15,12 +15,12 @@ #import #import -NSUInteger CKIntegerArrayHash(const NSUInteger *subhashes, NSUInteger count) +NSUInteger ASIntegerArrayHash(const NSUInteger *subhashes, NSUInteger count) { uint64_t result = subhashes[0]; for (int ii = 1; ii < count; ++ii) { - result = CKHashCombine(result, subhashes[ii]); + result = ASHashCombine(result, subhashes[ii]); } - return CKHash64ToNative(result); + return ASHash64ToNative(result); } diff --git a/AsyncDisplayKit/TextKit/ASEqualityHashHelpers.h b/AsyncDisplayKit/TextKit/ASEqualityHashHelpers.h index cac0b2a849..c88106c893 100644 --- a/AsyncDisplayKit/TextKit/ASEqualityHashHelpers.h +++ b/AsyncDisplayKit/TextKit/ASEqualityHashHelpers.h @@ -16,7 +16,7 @@ // This is the Hash128to64 function from Google's cityhash (available // under the MIT License). We use it to reduce multiple 64 bit hashes // into a single hash. -inline uint64_t CKHashCombine(const uint64_t upper, const uint64_t lower) { +inline uint64_t ASHashCombine(const uint64_t upper, const uint64_t lower) { // Murmur-inspired hashing. const uint64_t kMul = 0x9ddfea08eb382d69ULL; uint64_t a = (lower ^ upper) * kMul; @@ -28,13 +28,13 @@ inline uint64_t CKHashCombine(const uint64_t upper, const uint64_t lower) { } #if __LP64__ -inline size_t CKHash64ToNative(uint64_t key) { +inline size_t ASHash64ToNative(uint64_t key) { return key; } #else // Thomas Wang downscaling hash function -inline size_t CKHash64ToNative(uint64_t key) { +inline size_t ASHash64ToNative(uint64_t key) { key = (~key) + (key << 18); key = key ^ (key >> 31); key = key * 21; @@ -45,9 +45,9 @@ inline size_t CKHash64ToNative(uint64_t key) { } #endif -NSUInteger CKIntegerArrayHash(const NSUInteger *subhashes, NSUInteger count); +NSUInteger ASIntegerArrayHash(const NSUInteger *subhashes, NSUInteger count); -namespace CK { +namespace AS { // Default is not an ObjC class template struct is_objc_class : std::false_type { }; @@ -56,7 +56,7 @@ namespace CK { template struct is_objc_class::value, bool>::type> : std::true_type { }; - // CKUtils::hash()(value) -> either std::hash if c++ or [o hash] if ObjC object. + // ASUtils::hash()(value) -> either std::hash if c++ or [o hash] if ObjC object. template struct hash; // For non-objc types, defer to std::hash @@ -91,7 +91,7 @@ namespace CK { }; -namespace CKTupleOperations +namespace ASTupleOperations { // Recursive case (hash up to Index) template ::value - 1> @@ -101,8 +101,8 @@ namespace CKTupleOperations { size_t prev = _hash_helper::hash(tuple); using TypeForIndex = typename std::tuple_element::type; - size_t thisHash = CK::hash()(std::get(tuple)); - return CKHashCombine(prev, thisHash); + size_t thisHash = AS::hash()(std::get(tuple)); + return ASHashCombine(prev, thisHash); } }; @@ -113,7 +113,7 @@ namespace CKTupleOperations static size_t hash(Tuple const& tuple) { using TypeForIndex = typename std::tuple_element<0,Tuple>::type; - return CK::hash()(std::get<0>(tuple)); + return AS::hash()(std::get<0>(tuple)); } }; @@ -127,7 +127,7 @@ namespace CKTupleOperations using TypeForIndex = typename std::tuple_element::type; auto aValue = std::get(a); auto bValue = std::get(b); - return prev && CK::is_equal()(aValue, bValue); + return prev && AS::is_equal()(aValue, bValue); } }; @@ -140,7 +140,7 @@ namespace CKTupleOperations using TypeForIndex = typename std::tuple_element<0,Tuple>::type; auto& aValue = std::get<0>(a); auto& bValue = std::get<0>(b); - return CK::is_equal()(aValue, bValue); + return AS::is_equal()(aValue, bValue); } }; diff --git a/AsyncDisplayKit/TextKit/ASTextKitAttributes.mm b/AsyncDisplayKit/TextKit/ASTextKitAttributes.mm index 0bebf6f82d..5ca015fd84 100755 --- a/AsyncDisplayKit/TextKit/ASTextKitAttributes.mm +++ b/AsyncDisplayKit/TextKit/ASTextKitAttributes.mm @@ -33,5 +33,5 @@ size_t ASTextKitAttributes::hash() const std::hash()(shadowOpacity), std::hash()(shadowRadius), }; - return CKIntegerArrayHash(subhashes, sizeof(subhashes) / sizeof(subhashes[0])); + return ASIntegerArrayHash(subhashes, sizeof(subhashes) / sizeof(subhashes[0])); }