Olli Etuaho | cccf2b0 | 2017-07-05 14:50:54 +0300 | [diff] [blame^] | 1 | // |
| 2 | // Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | #include "compiler/translator/HashNames.h" |
| 8 | |
| 9 | namespace sh |
| 10 | { |
| 11 | |
| 12 | TString HashName(const TString &name, ShHashFunction64 hashFunction) |
| 13 | { |
| 14 | if (hashFunction == nullptr || name.empty()) |
| 15 | return name; |
| 16 | khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length()); |
| 17 | TStringStream stream; |
| 18 | stream << HASHED_NAME_PREFIX << std::hex << number; |
| 19 | TString hashedName = stream.str(); |
| 20 | return hashedName; |
| 21 | } |
| 22 | |
| 23 | } // namespace sh |