mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Add formatters for BigEndian and LittleEndian
This allows printing out BigEndian and LittleEndian values without having to perform a static_cast first.
This commit is contained in:
parent
0990c23fc3
commit
05c3755e62
Notes:
sideshowbarker
2024-07-18 07:37:38 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/05c3755e62f Pull-request: https://github.com/SerenityOS/serenity/pull/9118 Reviewed-by: https://github.com/alimpfard
1 changed files with 9 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Platform.h>
|
||||
|
||||
|
@ -134,6 +135,14 @@ private:
|
|||
template<typename T>
|
||||
using NetworkOrdered = BigEndian<T>;
|
||||
|
||||
template<typename T>
|
||||
requires(HasFormatter<T>) struct Formatter<LittleEndian<T>> : Formatter<T> {
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
requires(HasFormatter<T>) struct Formatter<BigEndian<T>> : Formatter<T> {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using AK::BigEndian;
|
||||
|
|
Loading…
Reference in a new issue