mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-14 16:58:34 +00:00
Mark jwt_set::case_compare and std::hash<jwt::string_view> noexcept
This commit is contained in:
parent
6c22d941a0
commit
735d77cdcf
2 changed files with 4 additions and 4 deletions
|
@ -273,7 +273,7 @@ namespace {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
unaligned_load(const char* p)
|
unaligned_load(const char* p) noexcept
|
||||||
{
|
{
|
||||||
std::size_t result;
|
std::size_t result;
|
||||||
std::memcpy(&result, p, sizeof(result));
|
std::memcpy(&result, p, sizeof(result));
|
||||||
|
@ -281,7 +281,7 @@ unaligned_load(const char* p)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t
|
inline size_t
|
||||||
hash_bytes(const void* ptr, size_t len, size_t seed)
|
hash_bytes(const void* ptr, size_t len, size_t seed) noexcept
|
||||||
{
|
{
|
||||||
const size_t m = 0x5bd1e995;
|
const size_t m = 0x5bd1e995;
|
||||||
size_t hash = seed ^ len;
|
size_t hash = seed ^ len;
|
||||||
|
@ -329,7 +329,7 @@ namespace std {
|
||||||
template <>
|
template <>
|
||||||
struct hash<jwt::string_view>
|
struct hash<jwt::string_view>
|
||||||
{
|
{
|
||||||
size_t operator()(const jwt::string_view& sv) const
|
size_t operator()(const jwt::string_view& sv) const noexcept
|
||||||
{
|
{
|
||||||
return jwt::hash_bytes((void*)sv.data(), sv.length(), static_cast<size_t>(0xc70f6907UL));
|
return jwt::hash_bytes((void*)sv.data(), sv.length(), static_cast<size_t>(0xc70f6907UL));
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ struct jwt_set
|
||||||
{
|
{
|
||||||
using is_transparent = std::true_type;
|
using is_transparent = std::true_type;
|
||||||
|
|
||||||
bool operator()(const jwt::string_view lhs, const jwt::string_view rhs) const
|
bool operator()(const jwt::string_view lhs, const jwt::string_view rhs) const noexcept
|
||||||
{
|
{
|
||||||
int ret = lhs.compare(rhs);
|
int ret = lhs.compare(rhs);
|
||||||
return (ret < 0);
|
return (ret < 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue