diff options
author | Yu-Cheng Ling <ycling@google.com> | 2018-05-31 15:50:55 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-05-31 15:53:48 -0700 |
commit | 6ca9a881ebd9bd3c7d4432dbddd779dafc8f936b (patch) | |
tree | 56c17e8259737e59c3e8d73884b67b7e95f6a2a2 /tensorflow/contrib/lite/util.cc | |
parent | 28f8cf5cf2281682f70f4674192f9f31d68c5ee1 (diff) |
Refactoring: Extract CombineHashes function into a shared module
PiperOrigin-RevId: 198793295
Diffstat (limited to 'tensorflow/contrib/lite/util.cc')
-rw-r--r-- | tensorflow/contrib/lite/util.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/util.cc b/tensorflow/contrib/lite/util.cc index fb4af07d06..8ccb65c24f 100644 --- a/tensorflow/contrib/lite/util.cc +++ b/tensorflow/contrib/lite/util.cc @@ -38,4 +38,14 @@ bool EqualArrayAndTfLiteIntArray(const TfLiteIntArray* a, const int b_size, return true; } +size_t CombineHashes(std::initializer_list<size_t> hashes) { + size_t result = 0; + // Hash combiner used by TensorFlow core. + for (size_t hash : hashes) { + result = result ^ + (hash + 0x9e3779b97f4a7800ULL + (result << 10) + (result >> 4)); + } + return result; +} + } // namespace tflite |