StormByte 2.0.0
C++26 foundation of the StormByte suite
 
Loading...
Searching...
No Matches
size.hxx File Reference
#include <StormByte/cstring.hxx>
#include <StormByte/type_traits.hxx>
#include <StormByte/visibility.h>
#include <cassert>
#include <compare>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <ostream>
#include <string>
Include dependency graph for size.hxx:

Go to the source code of this file.

Classes

class  StormByte::Size
 Byte count that is the same width on every host. More...
 
struct  StormByte::Unit
 Scale factor for Size (KiB, KB, …). More...
 

Namespaces

namespace  StormByte
 Root namespace of the StormByte suite.
 

Functions

template<Type::Integral T>
constexpr Size StormByte::operator* (T count, Unit unit) noexcept
 Scale unit by an integer count.
 
template<Type::Integral T>
constexpr Size StormByte::operator* (Unit unit, T count) noexcept
 Scale unit by an integer count.
 
template<Type::Integral T>
constexpr Size StormByte::operator* (T count, const Size &size) noexcept
 Scale size by a positive integer.
 
template<Type::Integral T>
constexpr Size StormByte::operator* (const Size &size, T count) noexcept
 Scale size by a positive integer.
 
template<Type::Integral T>
constexpr std::uint64_t StormByte::operator/ (const Size &size, T count) noexcept
 How many pieces of count bytes fit in size.
 
template<Type::Integral T>
constexpr std::uint64_t StormByte::operator% (const Size &size, T count) noexcept
 Leftover bytes after splitting size into pieces of count bytes.
 
std::ostream & StormByte::operator<< (std::ostream &stream, const Size &size)
 Writes the IEC text of size.
 

Variables

IEC units
constexpr Unit StormByte::B {1}
 2^0 bytes
 
constexpr Unit StormByte::KiB {1024}
 2^10 bytes
 
constexpr Unit StormByte::MiB {1024ull * 1024}
 2^20 bytes
 
constexpr Unit StormByte::GiB {1024ull * 1024 * 1024}
 2^30 bytes
 
constexpr Unit StormByte::TiB {1024ull * 1024 * 1024 * 1024}
 2^40 bytes
 
constexpr Unit StormByte::PiB {1024ull * 1024 * 1024 * 1024 * 1024}
 2^50 bytes
 
constexpr Unit StormByte::EiB {1024ull * 1024 * 1024 * 1024 * 1024 * 1024}
 2^60 bytes
 
SI units
constexpr Unit StormByte::KB {1000}
 10^3 bytes
 
constexpr Unit StormByte::MB {1000ull * 1000}
 10^6 bytes
 
constexpr Unit StormByte::GB {1000ull * 1000 * 1000}
 10^9 bytes
 
constexpr Unit StormByte::TB {1000ull * 1000 * 1000 * 1000}
 10^12 bytes
 
constexpr Unit StormByte::PB {1000ull * 1000 * 1000 * 1000 * 1000}
 10^15 bytes
 
constexpr Unit StormByte::EB {1000ull * 1000 * 1000 * 1000 * 1000 * 1000}
 10^18 bytes