blob: 369ef132ee3d1917909f119ad3fab2d30f82c507 [file] [log] [blame]
Olli Etuahocccf2b02017-07-05 14:50:54 +03001//
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
9namespace sh
10{
11
12TString 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