mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
Kernel: Switch static_asserts of a type size to AK::AssertSize
This will provide better debug ability when the size comparison fails.
This commit is contained in:
parent
112de58fe0
commit
472454cded
15 changed files with 25 additions and 19 deletions
|
@ -40,7 +40,7 @@ private:
|
|||
// NOTE: The rest of the header is 4 bytes
|
||||
};
|
||||
|
||||
static_assert(sizeof(ICMPHeader) == 4);
|
||||
static_assert(AssertSize<ICMPHeader, 4>());
|
||||
|
||||
struct [[gnu::packed]] ICMPEchoPacket {
|
||||
ICMPHeader header;
|
||||
|
|
|
@ -102,7 +102,7 @@ private:
|
|||
IPv4Address m_destination;
|
||||
};
|
||||
|
||||
static_assert(sizeof(IPv4Packet) == 20);
|
||||
static_assert(AssertSize<IPv4Packet, 20>());
|
||||
|
||||
inline NetworkOrdered<u16> internet_checksum(const void* ptr, size_t count)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
static constexpr u16 LargeSend = 0x800u;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TXDescriptor) == 16u);
|
||||
static_assert(AssertSize<TXDescriptor, 16u>());
|
||||
|
||||
struct [[gnu::packed]] RXDescriptor {
|
||||
volatile u16 buffer_size; // top 2 bits are reserved
|
||||
|
@ -83,7 +83,7 @@ private:
|
|||
static constexpr u16 CRCError = 0x8;
|
||||
};
|
||||
|
||||
static_assert(sizeof(RXDescriptor) == 16u);
|
||||
static_assert(AssertSize<RXDescriptor, 16u>());
|
||||
|
||||
enum class ChipVersion : u8 {
|
||||
Unknown = 0,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -36,7 +37,7 @@ private:
|
|||
NetworkOrdered<u16> m_value;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TCPOptionMSS) == 4);
|
||||
static_assert(AssertSize<TCPOptionMSS, 4>());
|
||||
|
||||
class [[gnu::packed]] TCPPacket {
|
||||
public:
|
||||
|
@ -92,6 +93,6 @@ private:
|
|||
NetworkOrdered<u16> m_urgent;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TCPPacket) == 20);
|
||||
static_assert(AssertSize<TCPPacket, 20>());
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue