StormByte 2.0.0
C++26 foundation of the StormByte suite
 
Loading...
Searching...
No Matches
byte_size.hxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024-2026 David C. Manuelda (StormBytePP)
3 *
4 * This file is part of StormByte.
5 *
6 * StormByte original source is dual-licensed:
7 *
8 * 1. GNU Lesser General Public License v3.0 (or later)
9 * You may redistribute and/or modify this file under the terms of the
10 * GNU Lesser General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option)
12 * any later version.
13 *
14 * 2. Commercial license
15 * Alternatively, this file may be used under the terms of a commercial
16 * license agreement with the copyright holder
17 * (David C. Manuelda <StormByte@gmail.com>).
18 *
19 * Both licenses apply only to original StormByte source in this repository.
20 * They do not cover other StormByte modules or any third-party material
21 * shipped with this repository (including everything under thirdparty/),
22 * which remains under its own license.
23 *
24 * Neither license grants any patent rights. Any patent licenses required
25 * to use this software or third-party components must be obtained separately
26 * from the patent holders.
27 *
28 * StormByte is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU Lesser General Public License for more details.
32 *
33 * You should have received a copy of the GNU Lesser General Public License
34 * version 3 along with StormByte. If not, see
35 * <https://www.gnu.org/licenses/lgpl-3.0.html>.
36 *
37 * SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-StormByte-Commercial
38 */
39
40#pragma once
41
42#include <StormByte/cstring.hxx>
43#include <StormByte/size.hxx>
47
48#include <cassert>
49#include <compare>
50#include <cstddef>
51#include <cstdint>
52#include <limits>
53#include <ostream>
54#include <string>
55#include <type_traits>
56#include <utility>
57
67namespace StormByte {
104 public:
108 struct Unit {
109 std::uint64_t bytes;
110
116 constexpr ByteSize operator()(Size count) const noexcept {
117 return ByteSize(Raw{}, Mul(static_cast<std::uint64_t>(static_cast<std::size_t>(count)), bytes));
118 }
119 };
120
121 static constexpr Unit B{1ull};
122 static constexpr Unit KiB{1024ull};
123 static constexpr Unit MiB{1024ull * 1024};
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};
128 static constexpr Unit KB{1000ull};
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};
134
138 constexpr ByteSize() noexcept: m_value(0) {}
139
145 template<Type::Integral T>
146 constexpr ByteSize(T value) noexcept: m_value(FromIntegral(value)) {}
147
152 constexpr explicit ByteSize(Size count) noexcept: m_value(static_cast<std::uint64_t>(static_cast<std::size_t>(count))) {}
153
158 constexpr ByteSize(const ByteSize& other) noexcept = default;
159
164 constexpr ByteSize(ByteSize&& other) noexcept = default;
165
169 constexpr ~ByteSize() noexcept = default;
170
176 constexpr ByteSize& operator=(const ByteSize& other) noexcept = default;
177
183 constexpr ByteSize& operator=(ByteSize&& other) noexcept = default;
184
191 template<Type::Integral T>
192 constexpr ByteSize& operator=(T value) noexcept {
193 m_value = FromIntegral(value);
194 return *this;
195 }
196
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);
204 }
205
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);
216 }
217
222 explicit operator CString() const noexcept;
223
228 explicit operator WCString() const noexcept;
229
234 STORMBYTE_FORCE_INLINE operator std::string() const {
235 // By name. static_cast<CString> is CString(std::string) on GCC,
236 // and that calls this operator again.
237 return operator CString().operator std::string();
238 }
239
246 friend constexpr bool operator==(ByteSize lhs, ByteSize rhs) noexcept {
247 return lhs.m_value == rhs.m_value;
248 }
249
254 template<Type::Integral T>
255 friend constexpr bool operator==(ByteSize lhs, T rhs) noexcept;
256
261 template<Type::Integral T>
262 friend constexpr bool operator==(T lhs, ByteSize rhs) noexcept;
263
270 friend constexpr bool operator==(ByteSize lhs, Size rhs) noexcept {
271 return lhs.m_value == static_cast<std::uint64_t>(static_cast<std::size_t>(rhs));
272 }
273
280 friend constexpr bool operator==(Size lhs, ByteSize rhs) noexcept {
281 return rhs == lhs;
282 }
283
290 friend constexpr std::strong_ordering operator<=>(ByteSize lhs, ByteSize rhs) noexcept {
291 return lhs.m_value <=> rhs.m_value;
292 }
293
298 template<Type::Integral T>
299 friend constexpr std::strong_ordering operator<=>(ByteSize lhs, T rhs) noexcept;
300
305 template<Type::Integral T>
306 friend constexpr std::strong_ordering operator<=>(T lhs, ByteSize rhs) noexcept;
307
314 friend constexpr std::strong_ordering operator<=>(ByteSize lhs, Size rhs) noexcept {
315 return lhs.m_value <=> static_cast<std::uint64_t>(static_cast<std::size_t>(rhs));
316 }
317
324 friend constexpr std::strong_ordering operator<=>(Size lhs, ByteSize rhs) noexcept {
325 return 0 <=> (rhs <=> lhs);
326 }
327
332 constexpr ByteSize& operator++() noexcept {
333 *this += ByteSize(Raw{}, 1);
334 return *this;
335 }
336
341 constexpr ByteSize operator++(int) noexcept {
342 const ByteSize old = *this;
343 ++*this;
344 return old;
345 }
346
351 constexpr ByteSize& operator--() noexcept {
352 *this -= ByteSize(Raw{}, 1);
353 return *this;
354 }
355
360 constexpr ByteSize operator--(int) noexcept {
361 const ByteSize old = *this;
362 --*this;
363 return old;
364 }
365
372 friend constexpr ByteSize operator+(ByteSize lhs, ByteSize rhs) noexcept {
373 return ByteSize(Raw{}, Add(lhs.m_value, rhs.m_value));
374 }
375
382 friend constexpr ByteSize operator-(ByteSize lhs, ByteSize rhs) noexcept {
383 return ByteSize(Raw{}, Sub(lhs.m_value, rhs.m_value));
384 }
385
386 ByteSize operator*(ByteSize) const = delete;
388 ByteSize operator/(ByteSize) const = delete;
390 ByteSize operator%(ByteSize) const = delete;
392
399 friend constexpr ByteSize operator*(ByteSize lhs, Size rhs) noexcept {
400 return ByteSize(Raw{}, Mul(lhs.m_value, static_cast<std::uint64_t>(static_cast<std::size_t>(rhs))));
401 }
402
409 friend constexpr ByteSize operator*(Size lhs, ByteSize rhs) noexcept {
410 return rhs * lhs;
411 }
412
419 friend constexpr ByteSize operator/(ByteSize lhs, Size rhs) noexcept {
420 return ByteSize(Raw{}, Div(lhs.m_value, static_cast<std::uint64_t>(static_cast<std::size_t>(rhs))));
421 }
422
429 friend constexpr ByteSize operator%(ByteSize lhs, Size rhs) noexcept {
430 return ByteSize(Raw{}, Mod(lhs.m_value, static_cast<std::uint64_t>(static_cast<std::size_t>(rhs))));
431 }
432
438 constexpr ByteSize& operator+=(ByteSize other) noexcept {
439 m_value = Add(m_value, other.m_value);
440 return *this;
441 }
442
448 constexpr ByteSize& operator-=(ByteSize other) noexcept {
449 m_value = Sub(m_value, other.m_value);
450 return *this;
451 }
452
458 constexpr ByteSize& operator*=(Size other) noexcept {
459 *this = *this * other;
460 return *this;
461 }
462
468 constexpr ByteSize& operator/=(Size other) noexcept {
469 *this = *this / other;
470 return *this;
471 }
472
478 constexpr ByteSize& operator%=(Size other) noexcept {
479 *this = *this % other;
480 return *this;
481 }
482
487 template<Type::Integral T>
488 friend constexpr ByteSize operator+(ByteSize lhs, T rhs) noexcept;
489
494 template<Type::Integral T>
495 friend constexpr ByteSize operator+(T lhs, ByteSize rhs) noexcept;
496
501 template<Type::Integral T>
502 friend constexpr ByteSize operator-(ByteSize lhs, T rhs) noexcept;
503
508 template<Type::Integral T>
509 friend constexpr ByteSize operator-(T lhs, ByteSize rhs) noexcept;
510
515 template<Type::Integral T>
516 friend constexpr ByteSize operator*(ByteSize lhs, T rhs) noexcept;
517
522 template<Type::Integral T>
523 friend constexpr ByteSize operator*(T lhs, ByteSize rhs) noexcept;
524
529 template<Type::Integral T>
530 friend constexpr ByteSize operator/(ByteSize lhs, T rhs) noexcept;
531
536 template<Type::Integral T>
537 friend constexpr ByteSize operator%(ByteSize lhs, T rhs) noexcept;
538
545 template<Type::Integral T>
546 constexpr ByteSize& operator+=(T value) noexcept {
547 *this = *this + value;
548 return *this;
549 }
550
557 template<Type::Integral T>
558 constexpr ByteSize& operator-=(T value) noexcept {
559 *this = *this - value;
560 return *this;
561 }
562
569 template<Type::Integral T>
570 constexpr ByteSize& operator*=(T value) noexcept {
571 *this = *this * value;
572 return *this;
573 }
574
581 template<Type::Integral T>
582 constexpr ByteSize& operator/=(T value) noexcept {
583 *this = *this / value;
584 return *this;
585 }
586
593 template<Type::Integral T>
594 constexpr ByteSize& operator%=(T value) noexcept {
595 *this = *this % value;
596 return *this;
597 }
598
599 private:
600 std::uint64_t m_value;
601
605 struct Raw {
606 explicit constexpr Raw() noexcept = default;
607 };
608
613 explicit constexpr ByteSize(Raw, std::uint64_t value) noexcept: m_value(value) {}
614
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);
626 }
627
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);
636 return lhs + rhs;
637 }
638
645 static constexpr std::uint64_t Sub(std::uint64_t lhs, std::uint64_t rhs) noexcept {
646 assert(lhs >= rhs);
647 return lhs - rhs;
648 }
649
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);
658 return lhs * rhs;
659 }
660
667 static constexpr std::uint64_t Div(std::uint64_t lhs, std::uint64_t rhs) noexcept {
668 assert(rhs != 0);
669 return lhs / rhs;
670 }
671
678 static constexpr std::uint64_t Mod(std::uint64_t lhs, std::uint64_t rhs) noexcept {
679 assert(rhs != 0);
680 return lhs % rhs;
681 }
682
690 template<Type::Integral T>
691 static constexpr ByteSize MixAdd(std::uint64_t lhs, T rhs) noexcept {
692 if constexpr (Type::Signed<T>) {
693 if (rhs < T{0}) {
694 const auto mag = static_cast<std::uint64_t>(0) - static_cast<std::uint64_t>(rhs);
695 return ByteSize(Raw{}, Sub(lhs, mag));
696 }
697 }
698 return ByteSize(Raw{}, Add(lhs, static_cast<std::uint64_t>(rhs)));
699 }
700
708 template<Type::Integral T>
709 static constexpr ByteSize MixSub(std::uint64_t lhs, T rhs) noexcept {
710 if constexpr (Type::Signed<T>) {
711 if (rhs < T{0}) {
712 const auto mag = static_cast<std::uint64_t>(0) - static_cast<std::uint64_t>(rhs);
713 return ByteSize(Raw{}, Add(lhs, mag));
714 }
715 }
716 return ByteSize(Raw{}, Sub(lhs, static_cast<std::uint64_t>(rhs)));
717 }
718
726 template<Type::Integral T>
727 static constexpr ByteSize MixMul(std::uint64_t lhs, T rhs) noexcept {
728 if constexpr (Type::Signed<T>)
729 assert(rhs >= T{0});
730 return ByteSize(Raw{}, Mul(lhs, static_cast<std::uint64_t>(rhs)));
731 }
732 };
733
741 template<Type::Integral T>
742 constexpr bool operator==(ByteSize lhs, T rhs) noexcept {
743 return lhs == ByteSize(rhs);
744 }
745
753 template<Type::Integral T>
754 constexpr bool operator==(T lhs, ByteSize rhs) noexcept {
755 return ByteSize(lhs) == rhs;
756 }
757
765 template<Type::Integral T>
766 constexpr std::strong_ordering operator<=>(ByteSize lhs, T rhs) noexcept {
767 return lhs <=> ByteSize(rhs);
768 }
769
777 template<Type::Integral T>
778 constexpr std::strong_ordering operator<=>(T lhs, ByteSize rhs) noexcept {
779 return ByteSize(lhs) <=> rhs;
780 }
781
789 template<Type::Integral T>
790 constexpr ByteSize operator+(ByteSize lhs, T rhs) noexcept {
791 return ByteSize::MixAdd(lhs.m_value, rhs);
792 }
793
801 template<Type::Integral T>
802 constexpr ByteSize operator+(T lhs, ByteSize rhs) noexcept {
803 return ByteSize::MixAdd(rhs.m_value, lhs);
804 }
805
813 template<Type::Integral T>
814 constexpr ByteSize operator-(ByteSize lhs, T rhs) noexcept {
815 return ByteSize::MixSub(lhs.m_value, rhs);
816 }
817
825 template<Type::Integral T>
826 constexpr ByteSize operator-(T lhs, ByteSize rhs) noexcept {
827 return ByteSize(lhs) - rhs;
828 }
829
837 template<Type::Integral T>
838 constexpr ByteSize operator*(ByteSize lhs, T rhs) noexcept {
839 return ByteSize::MixMul(lhs.m_value, rhs);
840 }
841
849 template<Type::Integral T>
850 constexpr ByteSize operator*(T lhs, ByteSize rhs) noexcept {
851 return ByteSize::MixMul(rhs.m_value, lhs);
852 }
853
861 template<Type::Integral T>
862 constexpr ByteSize operator/(ByteSize lhs, T rhs) noexcept {
863 return ByteSize(ByteSize::Raw{}, ByteSize::Div(lhs.m_value, ByteSize::FromIntegral(rhs)));
864 }
865
873 template<Type::Integral T>
874 constexpr ByteSize operator%(ByteSize lhs, T rhs) noexcept {
875 return ByteSize(ByteSize::Raw{}, ByteSize::Mod(lhs.m_value, ByteSize::FromIntegral(rhs)));
876 }
877
884 inline std::ostream& operator<<(std::ostream& stream, ByteSize size) {
885 stream << static_cast<std::string>(size);
886 return stream;
887 }
888
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;
905
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;
921
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;
937
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;
953
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;
969
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;
985
986 extern template STORMBYTE_PUBLIC ByteSize::operator char() const noexcept;
987 extern template STORMBYTE_PUBLIC ByteSize::operator signed char() const noexcept;
988 extern template STORMBYTE_PUBLIC ByteSize::operator unsigned char() const noexcept;
989 extern template STORMBYTE_PUBLIC ByteSize::operator short() const noexcept;
990 extern template STORMBYTE_PUBLIC ByteSize::operator unsigned short() const noexcept;
991 extern template STORMBYTE_PUBLIC ByteSize::operator int() const noexcept;
992 extern template STORMBYTE_PUBLIC ByteSize::operator unsigned int() const noexcept;
993 extern template STORMBYTE_PUBLIC ByteSize::operator long() 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;
999
1000 extern template STORMBYTE_PUBLIC bool operator==(ByteSize, char) 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;
1005 extern template STORMBYTE_PUBLIC bool operator==(ByteSize, int) noexcept;
1006 extern template STORMBYTE_PUBLIC bool operator==(ByteSize, unsigned int) noexcept;
1007 extern template STORMBYTE_PUBLIC bool operator==(ByteSize, long) 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;
1015
1016 extern template STORMBYTE_PUBLIC bool operator==(char, ByteSize) 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;
1021 extern template STORMBYTE_PUBLIC bool operator==(int, ByteSize) noexcept;
1022 extern template STORMBYTE_PUBLIC bool operator==(unsigned int, ByteSize) noexcept;
1023 extern template STORMBYTE_PUBLIC bool operator==(long, 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;
1031
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;
1047
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;
1063
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;
1079
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;
1095
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;
1111
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;
1127
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;
1143
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;
1159
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;
1175
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;
1192
1196 inline constexpr ByteSize B{1ull};
1197
1201 inline constexpr ByteSize KiB{1024ull};
1202
1206 inline constexpr ByteSize MiB{1024ull * 1024};
1207
1211 inline constexpr ByteSize GiB{1024ull * 1024 * 1024};
1212
1216 inline constexpr ByteSize TiB{1024ull * 1024 * 1024 * 1024};
1217
1221 inline constexpr ByteSize PiB{1024ull * 1024 * 1024 * 1024 * 1024};
1222
1226 inline constexpr ByteSize EiB{1024ull * 1024 * 1024 * 1024 * 1024 * 1024};
1227
1231 inline constexpr ByteSize KB{1000ull};
1232
1236 inline constexpr ByteSize MB{1000ull * 1000};
1237
1241 inline constexpr ByteSize GB{1000ull * 1000 * 1000};
1242
1246 inline constexpr ByteSize TB{1000ull * 1000 * 1000 * 1000};
1247
1251 inline constexpr ByteSize PB{1000ull * 1000 * 1000 * 1000 * 1000};
1252
1256 inline constexpr ByteSize EB{1000ull * 1000 * 1000 * 1000 * 1000 * 1000};
1257
1258}
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.
STL namespace.
#define STORMBYTE_FORCE_INLINE
Definition platform.h:89
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