From 31d2a395401d3ada2828a6a3713d69f926f132e4 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 21 Nov 2024 13:34:12 +0200 Subject: [PATCH] BAN: Add default constructors for BAN::{Little,Big}Endian --- BAN/include/BAN/Endianness.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/BAN/include/BAN/Endianness.h b/BAN/include/BAN/Endianness.h index 796891af..e1ccc09d 100644 --- a/BAN/include/BAN/Endianness.h +++ b/BAN/include/BAN/Endianness.h @@ -70,15 +70,19 @@ namespace BAN template struct LittleEndian { + constexpr LittleEndian() + : raw(0) + { } + constexpr LittleEndian(T value) - { - raw = host_to_little_endian(value); - } + : raw(host_to_little_endian(value)) + { } constexpr operator T() const { return host_to_little_endian(raw); } + private: T raw; }; @@ -86,15 +90,19 @@ namespace BAN template struct BigEndian { + constexpr BigEndian() + : raw(0) + { } + constexpr BigEndian(T value) - { - raw = host_to_big_endian(value); - } + : raw(host_to_big_endian(value)) + { } constexpr operator T() const { return host_to_big_endian(raw); } + private: T raw; };