mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Define traits for the const-variant of BigEndian and LittleEndian
This commit is contained in:
parent
bb9230bbcd
commit
e576bf975c
Notes:
sideshowbarker
2024-07-17 08:38:37 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/e576bf975c Pull-request: https://github.com/SerenityOS/serenity/pull/21849 Issue: https://github.com/SerenityOS/serenity/issues/21847 Reviewed-by: https://github.com/AtkinsSJ
1 changed files with 10 additions and 0 deletions
10
AK/Endian.h
10
AK/Endian.h
|
@ -125,11 +125,21 @@ struct Traits<LittleEndian<T>> : public GenericTraits<LittleEndian<T>> {
|
|||
static constexpr bool is_trivially_serializable() { return Traits<T>::is_trivially_serializable(); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Traits<LittleEndian<T> const> : public GenericTraits<LittleEndian<T> const> {
|
||||
static constexpr bool is_trivially_serializable() { return Traits<T>::is_trivially_serializable(); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Traits<BigEndian<T>> : public GenericTraits<BigEndian<T>> {
|
||||
static constexpr bool is_trivially_serializable() { return Traits<T>::is_trivially_serializable(); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Traits<BigEndian<T> const> : public GenericTraits<BigEndian<T> const> {
|
||||
static constexpr bool is_trivially_serializable() { return Traits<T>::is_trivially_serializable(); }
|
||||
};
|
||||
|
||||
constexpr u16 bitswap(u16 v)
|
||||
{
|
||||
v = ((v >> 1) & 0x5555) | ((v & 0x5555) << 1); // even & odd bits
|
||||
|
|
Loading…
Reference in a new issue