1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:47:45 +00:00

Kernel+AK: Separate out MACAddress and move it into AK

This commit is contained in:
AnotherTest 2020-04-04 15:48:28 +04:30 committed by Andreas Kling
parent 55b25b3c9b
commit 7d0bf9b5a9
5 changed files with 7 additions and 8 deletions

View file

@ -29,7 +29,6 @@
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/String.h> #include <AK/String.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <LibBareMetal/StdLib.h>
class [[gnu::packed]] MACAddress class [[gnu::packed]] MACAddress
{ {
@ -37,7 +36,7 @@ public:
MACAddress() {} MACAddress() {}
MACAddress(const u8 data[6]) MACAddress(const u8 data[6])
{ {
memcpy(m_data, data, 6); __builtin_memcpy(m_data, data, 6);
} }
MACAddress(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f) MACAddress(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f)
{ {
@ -58,7 +57,7 @@ public:
bool operator==(const MACAddress& other) const bool operator==(const MACAddress& other) const
{ {
return !memcmp(m_data, other.m_data, sizeof(m_data)); return !__builtin_memcmp(m_data, other.m_data, sizeof(m_data));
} }
String to_string() const String to_string() const

View file

@ -26,10 +26,10 @@
#pragma once #pragma once
#include <AK/MACAddress.h>
#include <AK/NetworkOrdered.h> #include <AK/NetworkOrdered.h>
#include <Kernel/Net/EtherType.h> #include <Kernel/Net/EtherType.h>
#include <Kernel/Net/IPv4.h> #include <Kernel/Net/IPv4.h>
#include <Kernel/Net/MACAddress.h>
namespace Kernel { namespace Kernel {

View file

@ -26,8 +26,8 @@
#pragma once #pragma once
#include <AK/MACAddress.h>
#include <AK/NetworkOrdered.h> #include <AK/NetworkOrdered.h>
#include <Kernel/Net/MACAddress.h>
#pragma GCC diagnostic ignored "-Warray-bounds" #pragma GCC diagnostic ignored "-Warray-bounds"

View file

@ -26,8 +26,8 @@
#pragma once #pragma once
#include <AK/MACAddress.h>
#include <Kernel/Net/IPv4.h> #include <Kernel/Net/IPv4.h>
#include <Kernel/Net/MACAddress.h>
struct ICMPType { struct ICMPType {
enum { enum {

View file

@ -28,6 +28,7 @@
#include <AK/ByteBuffer.h> #include <AK/ByteBuffer.h>
#include <AK/Function.h> #include <AK/Function.h>
#include <AK/MACAddress.h>
#include <AK/SinglyLinkedList.h> #include <AK/SinglyLinkedList.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <AK/WeakPtr.h> #include <AK/WeakPtr.h>
@ -36,7 +37,6 @@
#include <Kernel/Net/ARP.h> #include <Kernel/Net/ARP.h>
#include <Kernel/Net/ICMP.h> #include <Kernel/Net/ICMP.h>
#include <Kernel/Net/IPv4.h> #include <Kernel/Net/IPv4.h>
#include <Kernel/Net/MACAddress.h>
namespace Kernel { namespace Kernel {