AK: Define traits for the const-variant of BigEndian and LittleEndian

This commit is contained in:
Timothy Flynn 2023-11-08 13:57:56 -05:00 committed by Sam Atkins
parent bb9230bbcd
commit e576bf975c
Notes: sideshowbarker 2024-07-17 08:38:37 +09:00

View file

@ -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