1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

AK: Add Endian.h header to replace NetworkOrdered.h.

This commit is contained in:
asynts 2020-08-25 15:11:15 +02:00 committed by Andreas Kling
parent ecf6cbbd02
commit 10c6f062b3
20 changed files with 195 additions and 106 deletions

View file

@ -27,8 +27,8 @@
#pragma once
#include <AK/Assertions.h>
#include <AK/Endian.h>
#include <AK/IPv4Address.h>
#include <AK/NetworkOrdered.h>
#include <AK/String.h>
#include <AK/Types.h>
@ -131,7 +131,7 @@ inline NetworkOrdered<u16> internet_checksum(const void* ptr, size_t count)
u32 checksum = 0;
auto* w = (const u16*)ptr;
while (count > 1) {
checksum += convert_between_host_and_network(*w++);
checksum += AK::convert_between_host_and_network_endian(*w++);
if (checksum & 0x80000000)
checksum = (checksum & 0xffff) | (checksum >> 16);
count -= 2;