117 return ByteSize(Raw{}, Mul(
static_cast<std::uint64_t
>(
static_cast<std::size_t
>(count)), bytes));
124 static constexpr Unit GiB{1024ull * 1024 * 1024};
125 static constexpr Unit TiB{1024ull * 1024 * 1024 * 1024};
126 static constexpr Unit PiB{1024ull * 1024 * 1024 * 1024 * 1024};
127 static constexpr Unit EiB{1024ull * 1024 * 1024 * 1024 * 1024 * 1024};
129 static constexpr Unit MB{1000ull * 1000};
130 static constexpr Unit GB{1000ull * 1000 * 1000};
131 static constexpr Unit TB{1000ull * 1000 * 1000 * 1000};
132 static constexpr Unit PB{1000ull * 1000 * 1000 * 1000 * 1000};
133 static constexpr Unit EB{1000ull * 1000 * 1000 * 1000 * 1000 * 1000};
145 template<Type::Integral T>
146 constexpr ByteSize(T value)
noexcept: m_value(FromIntegral(value)) {}
152 constexpr explicit ByteSize(
Size count)
noexcept: m_value(
static_cast<std::uint64_t
>(
static_cast<std::size_t
>(count))) {}
191 template<
Type::Integral T>
193 m_value = FromIntegral(value);
201 constexpr operator std::size_t() const noexcept {
202 constexpr auto max =
static_cast<std::uint64_t
>(std::numeric_limits<std::size_t>::max());
203 return static_cast<std::size_t
>(m_value > max ? max : m_value);
211 template<Type::Integral T>
213 constexpr explicit operator T()
const noexcept {
214 constexpr auto max =
static_cast<std::uint64_t
>(std::numeric_limits<T>::max());
215 return static_cast<T
>(m_value > max ? max : m_value);
237 return operator CString().operator std::string();
247 return lhs.m_value == rhs.m_value;
254 template<Type::Integral T>
261 template<Type::Integral T>
271 return lhs.m_value ==
static_cast<std::uint64_t
>(
static_cast<std::size_t
>(rhs));
291 return lhs.m_value <=> rhs.m_value;
298 template<Type::Integral T>
305 template<Type::Integral T>
315 return lhs.m_value <=>
static_cast<std::uint64_t
>(
static_cast<std::size_t
>(rhs));
325 return 0 <=> (rhs <=> lhs);
373 return ByteSize(Raw{}, Add(lhs.m_value, rhs.m_value));
383 return ByteSize(Raw{}, Sub(lhs.m_value, rhs.m_value));
400 return ByteSize(Raw{}, Mul(lhs.m_value,
static_cast<std::uint64_t
>(
static_cast<std::size_t
>(rhs))));
420 return ByteSize(Raw{}, Div(lhs.m_value,
static_cast<std::uint64_t
>(
static_cast<std::size_t
>(rhs))));
430 return ByteSize(Raw{}, Mod(lhs.m_value,
static_cast<std::uint64_t
>(
static_cast<std::size_t
>(rhs))));
439 m_value = Add(m_value, other.m_value);
449 m_value = Sub(m_value, other.m_value);
459 *
this = *
this * other;
469 *
this = *
this / other;
479 *
this = *
this % other;
487 template<Type::Integral T>
494 template<Type::Integral T>
501 template<Type::Integral T>
508 template<Type::Integral T>
515 template<Type::Integral T>
522 template<Type::Integral T>
529 template<Type::Integral T>
536 template<Type::Integral T>
545 template<Type::Integral T>
547 *
this = *
this + value;
557 template<Type::Integral T>
559 *
this = *
this - value;
569 template<Type::Integral T>
571 *
this = *
this * value;
581 template<Type::Integral T>
583 *
this = *
this / value;
593 template<Type::Integral T>
595 *
this = *
this % value;
600 std::uint64_t m_value;
606 explicit constexpr Raw() noexcept = default;
613 explicit constexpr
ByteSize(Raw,
std::uint64_t value) noexcept: m_value(value) {}
621 template<Type::Integral T>
622 static constexpr std::uint64_t FromIntegral(T value)
noexcept {
623 if constexpr (Type::Signed<T>)
624 assert(value >= T{0});
625 return static_cast<std::uint64_t
>(value);
634 static constexpr std::uint64_t Add(std::uint64_t lhs, std::uint64_t rhs)
noexcept {
635 assert(lhs <= std::numeric_limits<std::uint64_t>::max() - rhs);
645 static constexpr std::uint64_t Sub(std::uint64_t lhs, std::uint64_t rhs)
noexcept {
656 static constexpr std::uint64_t Mul(std::uint64_t lhs, std::uint64_t rhs)
noexcept {
657 assert(rhs == 0 || lhs <= std::numeric_limits<std::uint64_t>::max() / rhs);
667 static constexpr std::uint64_t Div(std::uint64_t lhs, std::uint64_t rhs)
noexcept {
678 static constexpr std::uint64_t Mod(std::uint64_t lhs, std::uint64_t rhs)
noexcept {
690 template<Type::Integral T>
691 static constexpr ByteSize MixAdd(std::uint64_t lhs, T rhs)
noexcept {
692 if constexpr (Type::Signed<T>) {
694 const auto mag =
static_cast<std::uint64_t
>(0) -
static_cast<std::uint64_t
>(rhs);
695 return ByteSize(Raw{}, Sub(lhs, mag));
698 return ByteSize(Raw{}, Add(lhs,
static_cast<std::uint64_t
>(rhs)));
708 template<Type::Integral T>
709 static constexpr ByteSize MixSub(std::uint64_t lhs, T rhs)
noexcept {
710 if constexpr (Type::Signed<T>) {
712 const auto mag =
static_cast<std::uint64_t
>(0) -
static_cast<std::uint64_t
>(rhs);
713 return ByteSize(Raw{}, Add(lhs, mag));
716 return ByteSize(Raw{}, Sub(lhs,
static_cast<std::uint64_t
>(rhs)));
726 template<Type::Integral T>
727 static constexpr ByteSize MixMul(std::uint64_t lhs, T rhs)
noexcept {
728 if constexpr (Type::Signed<T>)
730 return ByteSize(Raw{}, Mul(lhs,
static_cast<std::uint64_t
>(rhs)));
741 template<Type::Integral T>
753 template<Type::Integral T>
765 template<Type::Integral T>
777 template<Type::Integral T>
789 template<Type::Integral T>
791 return ByteSize::MixAdd(lhs.m_value, rhs);
801 template<Type::Integral T>
803 return ByteSize::MixAdd(rhs.m_value, lhs);
813 template<Type::Integral T>
815 return ByteSize::MixSub(lhs.m_value, rhs);
825 template<Type::Integral T>
837 template<Type::Integral T>
839 return ByteSize::MixMul(lhs.m_value, rhs);
849 template<Type::Integral T>
851 return ByteSize::MixMul(rhs.m_value, lhs);
861 template<Type::Integral T>
863 return ByteSize(ByteSize::Raw{}, ByteSize::Div(lhs.m_value, ByteSize::FromIntegral(rhs)));
873 template<Type::Integral T>
875 return ByteSize(ByteSize::Raw{}, ByteSize::Mod(lhs.m_value, ByteSize::FromIntegral(rhs)));
885 stream << static_cast<std::string>(size);
890 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
char)
noexcept;
891 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
signed char)
noexcept;
892 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
unsigned char)
noexcept;
893 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
short)
noexcept;
894 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
unsigned short)
noexcept;
895 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
int)
noexcept;
896 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
unsigned int)
noexcept;
897 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
long)
noexcept;
898 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
unsigned long)
noexcept;
899 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
long long)
noexcept;
900 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
unsigned long long)
noexcept;
901 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
wchar_t)
noexcept;
902 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
char8_t)
noexcept;
903 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
char16_t)
noexcept;
904 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator=(
char32_t)
noexcept;
906 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
char)
noexcept;
907 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
signed char)
noexcept;
908 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
unsigned char)
noexcept;
909 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
short)
noexcept;
910 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
unsigned short)
noexcept;
911 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
int)
noexcept;
912 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
unsigned int)
noexcept;
913 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
long)
noexcept;
914 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
unsigned long)
noexcept;
915 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
long long)
noexcept;
916 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
unsigned long long)
noexcept;
917 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
wchar_t)
noexcept;
918 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
char8_t)
noexcept;
919 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
char16_t)
noexcept;
920 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator+=(
char32_t)
noexcept;
922 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
char)
noexcept;
923 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
signed char)
noexcept;
924 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
unsigned char)
noexcept;
925 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
short)
noexcept;
926 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
unsigned short)
noexcept;
927 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
int)
noexcept;
928 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
unsigned int)
noexcept;
929 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
long)
noexcept;
930 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
unsigned long)
noexcept;
931 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
long long)
noexcept;
932 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
unsigned long long)
noexcept;
933 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
wchar_t)
noexcept;
934 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
char8_t)
noexcept;
935 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
char16_t)
noexcept;
936 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator-=(
char32_t)
noexcept;
938 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
char)
noexcept;
939 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
signed char)
noexcept;
940 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
unsigned char)
noexcept;
941 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
short)
noexcept;
942 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
unsigned short)
noexcept;
943 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
int)
noexcept;
944 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
unsigned int)
noexcept;
945 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
long)
noexcept;
946 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
unsigned long)
noexcept;
947 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
long long)
noexcept;
948 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
unsigned long long)
noexcept;
949 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
wchar_t)
noexcept;
950 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
char8_t)
noexcept;
951 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
char16_t)
noexcept;
952 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator*=(
char32_t)
noexcept;
954 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
char)
noexcept;
955 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
signed char)
noexcept;
956 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
unsigned char)
noexcept;
957 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
short)
noexcept;
958 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
unsigned short)
noexcept;
959 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
int)
noexcept;
960 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
unsigned int)
noexcept;
961 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
long)
noexcept;
962 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
unsigned long)
noexcept;
963 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
long long)
noexcept;
964 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
unsigned long long)
noexcept;
965 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
wchar_t)
noexcept;
966 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
char8_t)
noexcept;
967 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
char16_t)
noexcept;
968 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator/=(
char32_t)
noexcept;
970 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
char)
noexcept;
971 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
signed char)
noexcept;
972 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
unsigned char)
noexcept;
973 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
short)
noexcept;
974 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
unsigned short)
noexcept;
975 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
int)
noexcept;
976 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
unsigned int)
noexcept;
977 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
long)
noexcept;
978 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
unsigned long)
noexcept;
979 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
long long)
noexcept;
980 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
unsigned long long)
noexcept;
981 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
wchar_t)
noexcept;
982 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
char8_t)
noexcept;
983 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
char16_t)
noexcept;
984 extern template STORMBYTE_PUBLIC ByteSize& ByteSize::operator%=(
char32_t)
noexcept;
987 extern template
STORMBYTE_PUBLIC ByteSize::operator
signed char() const noexcept;
988 extern template
STORMBYTE_PUBLIC ByteSize::operator
unsigned char() const noexcept;
990 extern template
STORMBYTE_PUBLIC ByteSize::operator
unsigned short() const noexcept;
992 extern template
STORMBYTE_PUBLIC ByteSize::operator
unsigned int() const noexcept;
994 extern template
STORMBYTE_PUBLIC ByteSize::operator
long long() const noexcept;
995 extern template
STORMBYTE_PUBLIC ByteSize::operator
wchar_t() const noexcept;
996 extern template
STORMBYTE_PUBLIC ByteSize::operator
char8_t() const noexcept;
997 extern template
STORMBYTE_PUBLIC ByteSize::operator
char16_t() const noexcept;
998 extern template
STORMBYTE_PUBLIC ByteSize::operator
char32_t() const noexcept;
1001 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
signed char) noexcept;
1002 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
unsigned char) noexcept;
1003 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
short) noexcept;
1004 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
unsigned short) noexcept;
1006 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
unsigned int) noexcept;
1008 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
unsigned long) noexcept;
1009 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
long long) noexcept;
1010 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
unsigned long long) noexcept;
1011 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
wchar_t) noexcept;
1012 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
char8_t) noexcept;
1013 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
char16_t) noexcept;
1014 extern template
STORMBYTE_PUBLIC bool operator==(ByteSize,
char32_t) noexcept;
1017 extern template
STORMBYTE_PUBLIC bool operator==(
signed char, ByteSize) noexcept;
1018 extern template
STORMBYTE_PUBLIC bool operator==(
unsigned char, ByteSize) noexcept;
1019 extern template
STORMBYTE_PUBLIC bool operator==(
short, ByteSize) noexcept;
1020 extern template
STORMBYTE_PUBLIC bool operator==(
unsigned short, ByteSize) noexcept;
1022 extern template
STORMBYTE_PUBLIC bool operator==(
unsigned int, ByteSize) noexcept;
1024 extern template
STORMBYTE_PUBLIC bool operator==(
unsigned long, ByteSize) noexcept;
1025 extern template
STORMBYTE_PUBLIC bool operator==(
long long, ByteSize) noexcept;
1026 extern template
STORMBYTE_PUBLIC bool operator==(
unsigned long long, ByteSize) noexcept;
1027 extern template
STORMBYTE_PUBLIC bool operator==(
wchar_t, ByteSize) noexcept;
1028 extern template
STORMBYTE_PUBLIC bool operator==(
char8_t, ByteSize) noexcept;
1029 extern template
STORMBYTE_PUBLIC bool operator==(
char16_t, ByteSize) noexcept;
1030 extern template
STORMBYTE_PUBLIC bool operator==(
char32_t, ByteSize) noexcept;
1032 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
char) noexcept;
1033 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
signed char) noexcept;
1034 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
unsigned char) noexcept;
1035 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
short) noexcept;
1036 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
unsigned short) noexcept;
1037 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
int) noexcept;
1038 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
unsigned int) noexcept;
1039 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
long) noexcept;
1040 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
unsigned long) noexcept;
1041 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
long long) noexcept;
1042 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
unsigned long long) noexcept;
1043 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
wchar_t) noexcept;
1044 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
char8_t) noexcept;
1045 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
char16_t) noexcept;
1046 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(ByteSize,
char32_t) noexcept;
1048 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
char, ByteSize) noexcept;
1049 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
signed char, ByteSize) noexcept;
1050 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
unsigned char, ByteSize) noexcept;
1051 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
short, ByteSize) noexcept;
1052 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
unsigned short, ByteSize) noexcept;
1053 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
int, ByteSize) noexcept;
1054 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
unsigned int, ByteSize) noexcept;
1055 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
long, ByteSize) noexcept;
1056 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
unsigned long, ByteSize) noexcept;
1057 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
long long, ByteSize) noexcept;
1058 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
unsigned long long, ByteSize) noexcept;
1059 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
wchar_t, ByteSize) noexcept;
1060 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
char8_t, ByteSize) noexcept;
1061 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
char16_t, ByteSize) noexcept;
1062 extern template
STORMBYTE_PUBLIC std::strong_ordering operator<=>(
char32_t, ByteSize) noexcept;
1064 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
char) noexcept;
1065 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
signed char) noexcept;
1066 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
unsigned char) noexcept;
1067 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
short) noexcept;
1068 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
unsigned short) noexcept;
1069 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
int) noexcept;
1070 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
unsigned int) noexcept;
1071 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
long) noexcept;
1072 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
unsigned long) noexcept;
1073 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
long long) noexcept;
1074 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
unsigned long long) noexcept;
1075 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
wchar_t) noexcept;
1076 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
char8_t) noexcept;
1077 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
char16_t) noexcept;
1078 extern template
STORMBYTE_PUBLIC ByteSize operator+(ByteSize,
char32_t) noexcept;
1080 extern template
STORMBYTE_PUBLIC ByteSize operator+(
char, ByteSize) noexcept;
1081 extern template
STORMBYTE_PUBLIC ByteSize operator+(
signed char, ByteSize) noexcept;
1082 extern template
STORMBYTE_PUBLIC ByteSize operator+(
unsigned char, ByteSize) noexcept;
1083 extern template
STORMBYTE_PUBLIC ByteSize operator+(
short, ByteSize) noexcept;
1084 extern template
STORMBYTE_PUBLIC ByteSize operator+(
unsigned short, ByteSize) noexcept;
1085 extern template
STORMBYTE_PUBLIC ByteSize operator+(
int, ByteSize) noexcept;
1086 extern template
STORMBYTE_PUBLIC ByteSize operator+(
unsigned int, ByteSize) noexcept;
1087 extern template
STORMBYTE_PUBLIC ByteSize operator+(
long, ByteSize) noexcept;
1088 extern template
STORMBYTE_PUBLIC ByteSize operator+(
unsigned long, ByteSize) noexcept;
1089 extern template
STORMBYTE_PUBLIC ByteSize operator+(
long long, ByteSize) noexcept;
1090 extern template
STORMBYTE_PUBLIC ByteSize operator+(
unsigned long long, ByteSize) noexcept;
1091 extern template
STORMBYTE_PUBLIC ByteSize operator+(
wchar_t, ByteSize) noexcept;
1092 extern template
STORMBYTE_PUBLIC ByteSize operator+(
char8_t, ByteSize) noexcept;
1093 extern template
STORMBYTE_PUBLIC ByteSize operator+(
char16_t, ByteSize) noexcept;
1094 extern template
STORMBYTE_PUBLIC ByteSize operator+(
char32_t, ByteSize) noexcept;
1096 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
char) noexcept;
1097 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
signed char) noexcept;
1098 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
unsigned char) noexcept;
1099 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
short) noexcept;
1100 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
unsigned short) noexcept;
1101 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
int) noexcept;
1102 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
unsigned int) noexcept;
1103 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
long) noexcept;
1104 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
unsigned long) noexcept;
1105 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
long long) noexcept;
1106 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
unsigned long long) noexcept;
1107 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
wchar_t) noexcept;
1108 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
char8_t) noexcept;
1109 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
char16_t) noexcept;
1110 extern template
STORMBYTE_PUBLIC ByteSize operator-(ByteSize,
char32_t) noexcept;
1112 extern template
STORMBYTE_PUBLIC ByteSize operator-(
char, ByteSize) noexcept;
1113 extern template
STORMBYTE_PUBLIC ByteSize operator-(
signed char, ByteSize) noexcept;
1114 extern template
STORMBYTE_PUBLIC ByteSize operator-(
unsigned char, ByteSize) noexcept;
1115 extern template
STORMBYTE_PUBLIC ByteSize operator-(
short, ByteSize) noexcept;
1116 extern template
STORMBYTE_PUBLIC ByteSize operator-(
unsigned short, ByteSize) noexcept;
1117 extern template
STORMBYTE_PUBLIC ByteSize operator-(
int, ByteSize) noexcept;
1118 extern template
STORMBYTE_PUBLIC ByteSize operator-(
unsigned int, ByteSize) noexcept;
1119 extern template
STORMBYTE_PUBLIC ByteSize operator-(
long, ByteSize) noexcept;
1120 extern template
STORMBYTE_PUBLIC ByteSize operator-(
unsigned long, ByteSize) noexcept;
1121 extern template
STORMBYTE_PUBLIC ByteSize operator-(
long long, ByteSize) noexcept;
1122 extern template
STORMBYTE_PUBLIC ByteSize operator-(
unsigned long long, ByteSize) noexcept;
1123 extern template
STORMBYTE_PUBLIC ByteSize operator-(
wchar_t, ByteSize) noexcept;
1124 extern template
STORMBYTE_PUBLIC ByteSize operator-(
char8_t, ByteSize) noexcept;
1125 extern template
STORMBYTE_PUBLIC ByteSize operator-(
char16_t, ByteSize) noexcept;
1126 extern template
STORMBYTE_PUBLIC ByteSize operator-(
char32_t, ByteSize) noexcept;
1128 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
char) noexcept;
1129 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
signed char) noexcept;
1130 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
unsigned char) noexcept;
1131 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
short) noexcept;
1132 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
unsigned short) noexcept;
1133 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
int) noexcept;
1134 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
unsigned int) noexcept;
1135 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
long) noexcept;
1136 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
unsigned long) noexcept;
1137 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
long long) noexcept;
1138 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
unsigned long long) noexcept;
1139 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
wchar_t) noexcept;
1140 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
char8_t) noexcept;
1141 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
char16_t) noexcept;
1142 extern template
STORMBYTE_PUBLIC ByteSize operator*(ByteSize,
char32_t) noexcept;
1144 extern template
STORMBYTE_PUBLIC ByteSize operator*(
char, ByteSize) noexcept;
1145 extern template
STORMBYTE_PUBLIC ByteSize operator*(
signed char, ByteSize) noexcept;
1146 extern template
STORMBYTE_PUBLIC ByteSize operator*(
unsigned char, ByteSize) noexcept;
1147 extern template
STORMBYTE_PUBLIC ByteSize operator*(
short, ByteSize) noexcept;
1148 extern template
STORMBYTE_PUBLIC ByteSize operator*(
unsigned short, ByteSize) noexcept;
1149 extern template
STORMBYTE_PUBLIC ByteSize operator*(
int, ByteSize) noexcept;
1150 extern template
STORMBYTE_PUBLIC ByteSize operator*(
unsigned int, ByteSize) noexcept;
1151 extern template
STORMBYTE_PUBLIC ByteSize operator*(
long, ByteSize) noexcept;
1152 extern template
STORMBYTE_PUBLIC ByteSize operator*(
unsigned long, ByteSize) noexcept;
1153 extern template
STORMBYTE_PUBLIC ByteSize operator*(
long long, ByteSize) noexcept;
1154 extern template
STORMBYTE_PUBLIC ByteSize operator*(
unsigned long long, ByteSize) noexcept;
1155 extern template
STORMBYTE_PUBLIC ByteSize operator*(
wchar_t, ByteSize) noexcept;
1156 extern template
STORMBYTE_PUBLIC ByteSize operator*(
char8_t, ByteSize) noexcept;
1157 extern template
STORMBYTE_PUBLIC ByteSize operator*(
char16_t, ByteSize) noexcept;
1158 extern template
STORMBYTE_PUBLIC ByteSize operator*(
char32_t, ByteSize) noexcept;
1160 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
char) noexcept;
1161 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
signed char) noexcept;
1162 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
unsigned char) noexcept;
1163 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
short) noexcept;
1164 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
unsigned short) noexcept;
1165 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
int) noexcept;
1166 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
unsigned int) noexcept;
1167 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
long) noexcept;
1168 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
unsigned long) noexcept;
1169 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
long long) noexcept;
1170 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
unsigned long long) noexcept;
1171 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
wchar_t) noexcept;
1172 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
char8_t) noexcept;
1173 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
char16_t) noexcept;
1174 extern template
STORMBYTE_PUBLIC ByteSize operator/(ByteSize,
char32_t) noexcept;
1176 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
char) noexcept;
1177 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
signed char) noexcept;
1178 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
unsigned char) noexcept;
1179 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
short) noexcept;
1180 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
unsigned short) noexcept;
1181 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
int) noexcept;
1182 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
unsigned int) noexcept;
1183 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
long) noexcept;
1184 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
unsigned long) noexcept;
1185 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
long long) noexcept;
1186 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
unsigned long long) noexcept;
1187 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
wchar_t) noexcept;
1188 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
char8_t) noexcept;
1189 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
char16_t) noexcept;
1190 extern template
STORMBYTE_PUBLIC ByteSize operator%(ByteSize,
char32_t) noexcept;
1226 inline constexpr ByteSize EiB{1024ull * 1024 * 1024 * 1024 * 1024 * 1024};
1251 inline constexpr ByteSize PB{1000ull * 1000 * 1000 * 1000 * 1000};
1256 inline constexpr ByteSize EB{1000ull * 1000 * 1000 * 1000 * 1000 * 1000};
Count of octets (uint64_t storage).
Definition byte_size.hxx:103
ByteSize operator%(ByteSize) const =delete
constexpr ByteSize & operator/=(T value) noexcept
Divide by an integer.
Definition byte_size.hxx:582
constexpr ByteSize operator++(int) noexcept
Postfix increment.
Definition byte_size.hxx:341
friend constexpr bool operator==(ByteSize lhs, Size rhs) noexcept
Mixed equality with Size.
Definition byte_size.hxx:270
friend constexpr ByteSize operator-(ByteSize lhs, ByteSize rhs) noexcept
Difference of lengths.
Definition byte_size.hxx:382
ByteSize operator*(ByteSize) const =delete
constexpr ByteSize & operator+=(ByteSize other) noexcept
Add other octets.
Definition byte_size.hxx:438
friend constexpr bool operator==(Size lhs, ByteSize rhs) noexcept
Mixed equality with Size.
Definition byte_size.hxx:280
ByteSize & operator%=(ByteSize)=delete
constexpr ByteSize(T value) noexcept
From an integer octet count.
Definition byte_size.hxx:146
constexpr ByteSize & operator--() noexcept
Prefix decrement.
Definition byte_size.hxx:351
friend constexpr ByteSize operator%(ByteSize lhs, Size rhs) noexcept
Remainder with a unit count.
Definition byte_size.hxx:429
constexpr ByteSize operator--(int) noexcept
Postfix decrement.
Definition byte_size.hxx:360
constexpr ByteSize & operator%=(T value) noexcept
Remainder with an integer.
Definition byte_size.hxx:594
friend constexpr std::strong_ordering operator<=>(ByteSize lhs, ByteSize rhs) noexcept
Numeric order.
Definition byte_size.hxx:290
friend constexpr ByteSize operator+(ByteSize lhs, ByteSize rhs) noexcept
Sum of lengths.
Definition byte_size.hxx:372
constexpr ByteSize & operator*=(Size other) noexcept
Scale by a unit count.
Definition byte_size.hxx:458
ByteSize operator/(ByteSize) const =delete
constexpr ByteSize & operator-=(ByteSize other) noexcept
Subtract other octets.
Definition byte_size.hxx:448
constexpr ByteSize & operator*=(T value) noexcept
Scale by an integer.
Definition byte_size.hxx:570
friend constexpr bool operator==(ByteSize lhs, ByteSize rhs) noexcept
Numeric equality.
Definition byte_size.hxx:246
ByteSize & operator/=(ByteSize)=delete
constexpr ByteSize & operator/=(Size other) noexcept
Divide by a unit count.
Definition byte_size.hxx:468
constexpr ByteSize & operator-=(T value) noexcept
Subtract an integer octet count.
Definition byte_size.hxx:558
constexpr ByteSize(Size count) noexcept
From an abstract unit count interpreted as octets.
Definition byte_size.hxx:152
constexpr ByteSize & operator%=(Size other) noexcept
Remainder with a unit count.
Definition byte_size.hxx:478
constexpr ByteSize(ByteSize &&other) noexcept=default
Move constructor.
friend constexpr ByteSize operator*(Size lhs, ByteSize rhs) noexcept
Scale by a unit count.
Definition byte_size.hxx:409
friend constexpr ByteSize operator/(ByteSize lhs, Size rhs) noexcept
Divide by a unit count.
Definition byte_size.hxx:419
constexpr ~ByteSize() noexcept=default
Destructor.
constexpr ByteSize & operator++() noexcept
Prefix increment.
Definition byte_size.hxx:332
friend constexpr ByteSize operator*(ByteSize lhs, Size rhs) noexcept
Scale by a unit count.
Definition byte_size.hxx:399
friend constexpr std::strong_ordering operator<=>(ByteSize lhs, Size rhs) noexcept
Mixed order with Size.
Definition byte_size.hxx:314
friend constexpr std::strong_ordering operator<=>(Size lhs, ByteSize rhs) noexcept
Mixed order with Size.
Definition byte_size.hxx:324
ByteSize & operator*=(ByteSize)=delete
constexpr ByteSize() noexcept
Zero octets.
Definition byte_size.hxx:138
constexpr ByteSize & operator+=(T value) noexcept
Add an integer octet count.
Definition byte_size.hxx:546
constexpr ByteSize(const ByteSize &other) noexcept=default
Copy constructor.
Owned NUL-terminated buffer, safe to use across a DLL boundary.
Definition cstring.hxx:97
Count of abstract units (uint64_t storage).
Definition size.hxx:100
Owned NUL-terminated wide buffer, safe to use across a DLL boundary.
Definition wcstring.hxx:98
Same type after stripping cv and references from both sides.
Definition relations.hxx:94
Root namespace of the StormByte suite.
constexpr ByteSize GB
10^9 octets.
Definition byte_size.hxx:1241
bool operator==(std::span< const std::byte > bytes, const BinaryData &data) noexcept
Equality of a span against a sequence.
Definition binary_data.hxx:777
constexpr ByteSize PB
10^15 octets.
Definition byte_size.hxx:1251
constexpr ByteSize EB
10^18 octets.
Definition byte_size.hxx:1256
constexpr ByteSize KB
10^3 octets.
Definition byte_size.hxx:1231
constexpr ByteSize operator*(ByteSize lhs, T rhs) noexcept
Mixed product.
Definition byte_size.hxx:838
std::ostream & operator<<(std::ostream &stream, ByteSize size)
Writes the IEC human-readable length.
Definition byte_size.hxx:884
constexpr ByteSize MB
10^6 octets.
Definition byte_size.hxx:1236
constexpr ByteSize KiB
2^10 octets.
Definition byte_size.hxx:1201
constexpr ByteSize GiB
2^30 octets.
Definition byte_size.hxx:1211
constexpr ByteSize PiB
2^50 octets.
Definition byte_size.hxx:1221
constexpr ByteSize TB
10^12 octets.
Definition byte_size.hxx:1246
constexpr ByteSize operator+(ByteSize lhs, T rhs) noexcept
Mixed sum.
Definition byte_size.hxx:790
constexpr ByteSize TiB
2^40 octets.
Definition byte_size.hxx:1216
constexpr ByteSize operator-(ByteSize lhs, T rhs) noexcept
Mixed difference.
Definition byte_size.hxx:814
constexpr ByteSize MiB
2^20 octets.
Definition byte_size.hxx:1206
std::strong_ordering operator<=>(std::span< const std::byte > bytes, const BinaryData &data) noexcept
Three-way comparison of a span against a sequence.
Definition binary_data.hxx:797
constexpr ByteSize B
One octet.
Definition byte_size.hxx:1196
constexpr ByteSize operator%(ByteSize lhs, T rhs) noexcept
Mixed remainder.
Definition byte_size.hxx:874
constexpr ByteSize EiB
2^60 octets.
Definition byte_size.hxx:1226
constexpr ByteSize operator/(ByteSize lhs, T rhs) noexcept
Mixed quotient.
Definition byte_size.hxx:862
Octet count. Defined in byte_size.hxx. Forwarded so Type::Numeral can name it.
Host-width-stable count (uint64_t), implicit only to std::size_t.
One-octet scale used by the named factories.
Definition byte_size.hxx:108
std::uint64_t bytes
Octets in one unit.
Definition byte_size.hxx:109
constexpr ByteSize operator()(Size count) const noexcept
Scale count units into a ByteSize.
Definition byte_size.hxx:116
#define STORMBYTE_PUBLIC
Definition visibility.h:52