Erixonich commented on code in PR #7750: URL: https://github.com/apache/ignite-3/pull/7750#discussion_r2918290732
########## modules/platforms/cpp/ignite/common/detail/hash_utils.h: ########## @@ -0,0 +1,112 @@ +// 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. +// + +// + +#pragma once +#include "big_decimal.h" +#include "ignite_date_time.h" +#include "ignite_time.h" +#include "ignite_timestamp.h" +#include "uuid.h" + +#include "Murmur3Hash.h" + +#include <cstdint> +#include <cstring> +#include <string> +#include <vector> + +namespace ignite::detail { + +inline std::uint64_t murmur_original( const void * key, std::size_t len, std::uint64_t seed) { + std::uint64_t res[2]; + MurmurHash3_x64_128(key, len, seed, res); + + return res[0]; +} + +inline std::uint64_t hash64(std::int8_t data, std::uint64_t seed) { + + return murmur_original(&data, sizeof(data), seed); +} + +inline std::uint64_t hash64(std::uint8_t data, std::uint64_t seed) { + return murmur_original(&data, sizeof(data), seed); +} + +inline std::uint64_t hash64(std::int16_t data, std::uint64_t seed) { + return murmur_original(&data, sizeof(data), seed); +} + +inline std::uint64_t hash64(std::uint16_t data, std::uint64_t seed) { + return murmur_original(&data, sizeof(data), seed); +} + +inline std::uint64_t hash64(std::int32_t data, std::uint64_t seed) { + return murmur_original(&data, sizeof(data), seed); +} + +inline std::uint64_t hash64(std::uint32_t data, std::uint64_t seed) { + return murmur_original(&data, sizeof(data), seed); +} + +inline std::uint64_t hash64(std::int64_t data, std::uint64_t seed) { + return murmur_original(&data, sizeof(data), seed); +} + +inline std::uint64_t hash64(std::uint64_t data, std::uint64_t seed) { + return murmur_original(&data, sizeof(data), seed); Review Comment: All our platforms are little-endian. @isapego should we address it? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
