Skip to content

Commit 3be23b0

Browse files
committed
shared_str: use already calculated crc32 for std::hash overload
Remove unused str_hash_function
1 parent 2625a3b commit 3be23b0

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/xrCore/xrstring.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ struct XRCORE_API str_value_cmp
2525
IC bool operator()(const str_value* A, const str_value* B) const { return A->dwCRC < B->dwCRC; };
2626
};
2727

28-
struct XRCORE_API str_hash_function
29-
{
30-
IC u32 operator()(str_value const* const value) const { return value->dwCRC; };
31-
};
32-
3328
#pragma warning(pop)
3429

3530
struct str_container_impl;
@@ -196,8 +191,7 @@ struct std::hash<shared_str>
196191
{
197192
[[nodiscard]] size_t operator()(const shared_str& str) const noexcept
198193
{
199-
const auto str_val = str._get();
200-
return std::hash<pcstr>{}(str_val ? str_val->value : nullptr);
194+
return str ? str._get()->dwCRC : std::hash<pcstr>{}(nullptr);
201195
}
202196
};
203197

0 commit comments

Comments
 (0)