Remove a layer of indirection in strong_hash.

PiperOrigin-RevId: 341735651
Change-Id: I485054a827852526f8faa46398c5afe45b39d8f4
This commit is contained in:
Mihai Maruseac 2020-11-10 17:57:32 -08:00 committed by TensorFlower Gardener
parent 404e6a19db
commit e941985dc4
5 changed files with 10 additions and 53 deletions

View File

@ -702,11 +702,12 @@ cc_library(
cc_library(
name = "strong_hash",
hdrs = ["strong_hash.h"],
textual_hdrs = ["strong_hash.h"],
deps = [
":platform",
":types",
] + tf_platform_deps("strong_hash"),
"@highwayhash//:sip_hash",
],
)
cc_library(

View File

@ -385,17 +385,6 @@ cc_library(
alwayslink = 1,
)
cc_library(
name = "strong_hash",
tags = [
"manual",
"no_oss",
"nobuilder",
],
textual_hdrs = ["strong_hash.h"],
deps = ["@highwayhash//:sip_hash"],
)
cc_library(
name = "subprocess",
srcs = ["subprocess.cc"],

View File

@ -569,7 +569,6 @@ def tf_additional_lib_hdrs():
"//tensorflow/core/platform/default:mutex_data.h",
"//tensorflow/core/platform/default:notification.h",
"//tensorflow/core/platform/default:stacktrace.h",
"//tensorflow/core/platform/default:strong_hash.h",
"//tensorflow/core/platform/default:test_benchmark.h",
"//tensorflow/core/platform/default:tracing_impl.h",
"//tensorflow/core/platform/default:unbounded_work_queue.h",

View File

@ -1,32 +0,0 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed 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.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_STRONG_HASH_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_STRONG_HASH_H_
#include "highwayhash/sip_hash.h" // from @highwayhash
#include "highwayhash/state_helpers.h" // from @highwayhash
namespace tensorflow {
inline uint64 StrongKeyedHash(const tensorflow::uint64 (&key)[2],
const string& s) {
return highwayhash::StringHasher<highwayhash::SipHashState>()(
{key[0], key[1]}, s);
}
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PLATFORM_DEFAULT_STRONG_HASH_H_

View File

@ -16,6 +16,8 @@ limitations under the License.
#ifndef TENSORFLOW_CORE_PLATFORM_STRONG_HASH_H_
#define TENSORFLOW_CORE_PLATFORM_STRONG_HASH_H_
#include "highwayhash/sip_hash.h" // from @highwayhash
#include "highwayhash/state_helpers.h" // from @highwayhash
#include "tensorflow/core/platform/platform.h"
#include "tensorflow/core/platform/types.h"
@ -32,14 +34,12 @@ namespace tensorflow {
// string input = "input string";
// uint64 hash_value = StrongKeyedHash(key, input);
//
uint64 StrongKeyedHash(const tensorflow::uint64 (&)[2], const string&);
inline uint64 StrongKeyedHash(const tensorflow::uint64 (&key)[2],
const string& s) {
return highwayhash::StringHasher<highwayhash::SipHashState>()(
{key[0], key[1]}, s);
}
} // namespace tensorflow
#if defined(PLATFORM_GOOGLE)
#include "tensorflow/core/platform/google/strong_hash.h"
#else
#include "tensorflow/core/platform/default/strong_hash.h"
#endif
#endif // TENSORFLOW_CORE_PLATFORM_STRONG_HASH_H_