Skip to content

Commit

Permalink
Merge pull request #2184 from nvmkuruc/ndrhash
Browse files Browse the repository at this point in the history
Replace boost hash usage with TfHash in pxr/usd/ndr

(Internal change: 2264249)
  • Loading branch information
pixar-oss committed Feb 28, 2023
2 parents a397d06 + 70e55a7 commit f287b78
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pxr/usd/ndr/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
//

#include "pxr/pxr.h"
#include "pxr/base/tf/hash.h"
#include "pxr/base/tf/pathUtils.h"
#include "pxr/base/tf/stringUtils.h"
#include "pxr/base/tf/type.h"
Expand All @@ -41,8 +42,6 @@
#include "pxr/base/plug/registry.h"
#include "pxr/base/tf/envSetting.h"

#include <boost/functional/hash.hpp>

PXR_NAMESPACE_OPEN_SCOPE

TF_DEFINE_ENV_SETTING(
Expand Down Expand Up @@ -165,11 +164,9 @@ _GetIdentifierForAsset(const SdfAssetPath &asset,
const TfToken &subIdentifier,
const TfToken &sourceType)
{
size_t h = 0;
boost::hash_combine(h, asset);
for (const auto &i : metadata) {
boost::hash_combine(h, i.first.GetString());
boost::hash_combine(h, i.second);
size_t h = TfHash()(asset);
for (const auto &i : metadata) {
h = TfHash::Combine(h, i.first.GetString(), i.second);
}

return NdrIdentifier(TfStringPrintf(
Expand All @@ -183,11 +180,9 @@ static NdrIdentifier
_GetIdentifierForSourceCode(const std::string &sourceCode,
const NdrTokenMap &metadata)
{
size_t h = 0;
boost::hash_combine(h, sourceCode);
for (const auto &i : metadata) {
boost::hash_combine(h, i.first.GetString());
boost::hash_combine(h, i.second);
size_t h = TfHash()(sourceCode);
for (const auto &i : metadata) {
h = TfHash::Combine(h, i.first.GetString(), i.second);
}
return NdrIdentifier(std::to_string(h));
}
Expand Down

0 comments on commit f287b78

Please sign in to comment.