Nexus Engine
v0.0.1
Theme:
Default
League
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
NetworkAddress.inl
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
3
#pragma once
4
5
template
<>
6
struct
NEXUS_API
std::hash<Nexus::Network::NetworkAddress> {
7
Nexus::usize
operator()
(
const
Nexus::Network::NetworkAddress
& address)
const
noexcept
{
8
const
Nexus::usize
h1 = std::hash<std::string>{}(address.Host());
9
const
Nexus::usize
h2 = std::hash<Nexus::uint16>{}(address.Port());
10
11
// 64-bit mix inspired by the standard hash-combine pattern.
12
static
constexpr
auto
PHI = 0x9e3779b97f4a7c15ULL;
13
return
h1 ^ (h2 +
static_cast<
Nexus::usize
>
(PHI) + (h1 << 6) + (h1 >> 2));
14
}
15
};
NEXUS_API
#define NEXUS_API
Definition
Export.hpp:12
Nexus::Network::NetworkAddress
Definition
NetworkAddress.cppm:14
Nexus::usize
std::size_t usize
Definition
Types.cppm:25
std::hash< Nexus::Network::NetworkAddress >::operator()
Nexus::usize operator()(const Nexus::Network::NetworkAddress &address) const noexcept
Definition
NetworkAddress.inl:7
Source
Engine
Network
Common
Public
NetworkAddress.inl
Generated by
1.18.0