aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/apache/orc/c++/src/Murmur3.cc
diff options
context:
space:
mode:
authoriaz1607 <iaz1607@yandex-team.ru>2022-02-10 16:45:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:37 +0300
commite5437feb4ac2d2dc044e1090b9312dde5ef197e0 (patch)
treef5a238c69dd20a1fa2092127a31b8aff25020f7d /contrib/libs/apache/orc/c++/src/Murmur3.cc
parentf4945d0a44b8770f0801de3056aa41639b0b7bd2 (diff)
downloadydb-e5437feb4ac2d2dc044e1090b9312dde5ef197e0.tar.gz
Restoring authorship annotation for <iaz1607@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/apache/orc/c++/src/Murmur3.cc')
-rw-r--r--contrib/libs/apache/orc/c++/src/Murmur3.cc196
1 files changed, 98 insertions, 98 deletions
diff --git a/contrib/libs/apache/orc/c++/src/Murmur3.cc b/contrib/libs/apache/orc/c++/src/Murmur3.cc
index b45bd6d492..63cf797a04 100644
--- a/contrib/libs/apache/orc/c++/src/Murmur3.cc
+++ b/contrib/libs/apache/orc/c++/src/Murmur3.cc
@@ -1,98 +1,98 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Adaptor.hh"
-#include "Murmur3.hh"
-
-#define ROTL64(x, r) ((x << r) | (x >> (64 - r)))
-
-namespace orc {
-
- inline uint64_t rotl64 ( uint64_t x, int8_t r ) {
- return (x << r) | (x >> (64 - r));
- }
-
- inline uint64_t Murmur3::fmix64(uint64_t value) {
- value ^= (value >> 33);
- value *= 0xff51afd7ed558ccdL;
- value ^= (value >> 33);
- value *= 0xc4ceb9fe1a85ec53L;
- value ^= (value >> 33);
- return value;
- }
-
- uint64_t Murmur3::hash64(const uint8_t *data, uint32_t len) {
- return hash64(data, len, DEFAULT_SEED);
- }
-
- DIAGNOSTIC_PUSH
-
-#if defined(__clang__)
- DIAGNOSTIC_IGNORE("-Wimplicit-fallthrough")
-#endif
-
- uint64_t Murmur3::hash64(const uint8_t *data, uint32_t len, uint32_t seed) {
- uint64_t h = seed;
- uint32_t blocks = len >> 3;
-
- const uint64_t* src = reinterpret_cast<const uint64_t*>(data);
- uint64_t c1 = 0x87c37b91114253d5L;
- uint64_t c2 = 0x4cf5ad432745937fL;
- for (uint32_t i = 0; i < blocks; i++) {
- uint64_t k = src[i];
- k *= c1;
- k = ROTL64(k, 31);
- k *= c2;
-
- h ^= k;
- h = ROTL64(h, 27);
- h = h * 5 + 0x52dce729;
- }
-
- uint64_t k = 0;
- uint32_t idx = blocks << 3;
- switch (len - idx) {
- case 7:
- k ^= static_cast<uint64_t>(data[idx + 6]) << 48;
- case 6:
- k ^= static_cast<uint64_t>(data[idx + 5]) << 40;
- case 5:
- k ^= static_cast<uint64_t>(data[idx + 4]) << 32;
- case 4:
- k ^= static_cast<uint64_t>(data[idx + 3]) << 24;
- case 3:
- k ^= static_cast<uint64_t>(data[idx + 2]) << 16;
- case 2:
- k ^= static_cast<uint64_t>(data[idx + 1]) << 8;
- case 1:
- k ^= static_cast<uint64_t>(data[idx + 0]);
-
- k *= c1;
- k = ROTL64(k, 31);
- k *= c2;
- h ^= k;
- }
-
- h ^= len;
- h = fmix64(h);
- return h;
- }
-
- DIAGNOSTIC_POP
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Adaptor.hh"
+#include "Murmur3.hh"
+
+#define ROTL64(x, r) ((x << r) | (x >> (64 - r)))
+
+namespace orc {
+
+ inline uint64_t rotl64 ( uint64_t x, int8_t r ) {
+ return (x << r) | (x >> (64 - r));
+ }
+
+ inline uint64_t Murmur3::fmix64(uint64_t value) {
+ value ^= (value >> 33);
+ value *= 0xff51afd7ed558ccdL;
+ value ^= (value >> 33);
+ value *= 0xc4ceb9fe1a85ec53L;
+ value ^= (value >> 33);
+ return value;
+ }
+
+ uint64_t Murmur3::hash64(const uint8_t *data, uint32_t len) {
+ return hash64(data, len, DEFAULT_SEED);
+ }
+
+ DIAGNOSTIC_PUSH
+
+#if defined(__clang__)
+ DIAGNOSTIC_IGNORE("-Wimplicit-fallthrough")
+#endif
+
+ uint64_t Murmur3::hash64(const uint8_t *data, uint32_t len, uint32_t seed) {
+ uint64_t h = seed;
+ uint32_t blocks = len >> 3;
+
+ const uint64_t* src = reinterpret_cast<const uint64_t*>(data);
+ uint64_t c1 = 0x87c37b91114253d5L;
+ uint64_t c2 = 0x4cf5ad432745937fL;
+ for (uint32_t i = 0; i < blocks; i++) {
+ uint64_t k = src[i];
+ k *= c1;
+ k = ROTL64(k, 31);
+ k *= c2;
+
+ h ^= k;
+ h = ROTL64(h, 27);
+ h = h * 5 + 0x52dce729;
+ }
+
+ uint64_t k = 0;
+ uint32_t idx = blocks << 3;
+ switch (len - idx) {
+ case 7:
+ k ^= static_cast<uint64_t>(data[idx + 6]) << 48;
+ case 6:
+ k ^= static_cast<uint64_t>(data[idx + 5]) << 40;
+ case 5:
+ k ^= static_cast<uint64_t>(data[idx + 4]) << 32;
+ case 4:
+ k ^= static_cast<uint64_t>(data[idx + 3]) << 24;
+ case 3:
+ k ^= static_cast<uint64_t>(data[idx + 2]) << 16;
+ case 2:
+ k ^= static_cast<uint64_t>(data[idx + 1]) << 8;
+ case 1:
+ k ^= static_cast<uint64_t>(data[idx + 0]);
+
+ k *= c1;
+ k = ROTL64(k, 31);
+ k *= c2;
+ h ^= k;
+ }
+
+ h ^= len;
+ h = fmix64(h);
+ return h;
+ }
+
+ DIAGNOSTIC_POP
+
+}