Skip to content

Commit

Permalink
dropme: once oxenc constexpr is merged
Browse files Browse the repository at this point in the history
  • Loading branch information
dr7ana committed Jan 13, 2025
1 parent 208eed6 commit bdab0cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions llarp/net/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ namespace llarp
namespace utils
{
static constexpr uint32_t add_u32(uint32_t x) { return uint32_t{x & 0xFFff} + uint32_t{x >> 16}; }
static constexpr uint32_t add_u32(ipv4 x) { return add_u32(oxenc::host_to_big(x.addr)); }
// static constexpr uint32_t add_u32(ipv4 x) { return add_u32(oxenc::host_to_big(x.addr)); }
static constexpr uint32_t add_u32(ipv4 x) { return add_u32(htonl(x.addr)); }

static constexpr uint32_t sub_u32(uint32_t x) { return add_u32(~x); }
static constexpr uint32_t sub_u32(ipv4 x) { return sub_u32(oxenc::host_to_big(x.addr)); }
// static constexpr uint32_t sub_u32(ipv4 x) { return sub_u32(oxenc::host_to_big(x.addr)); }
static constexpr uint32_t sub_u32(ipv4 x) { return sub_u32(ntohl(x.addr)); }

uint16_t ip_checksum(const uint8_t *buf, size_t sz)
{
Expand Down

0 comments on commit bdab0cf

Please sign in to comment.