literals.hpp 1.2 KB

123456789101112131415161718192021
  1. #pragma once
  2. namespace nall {
  3. inline constexpr auto operator"" _Kibit(unsigned long long value) { return value * 1024 / 8; }
  4. inline constexpr auto operator"" _Mibit(unsigned long long value) { return value * 1024 * 1024 / 8; }
  5. inline constexpr auto operator"" _Gibit(unsigned long long value) { return value * 1024 * 1024 * 1024 / 8; }
  6. inline constexpr auto operator"" _Tibit(unsigned long long value) { return value * 1024 * 1024 * 1024 * 1024 / 8; }
  7. inline constexpr auto operator"" _KiB(unsigned long long value) { return value * 1024; }
  8. inline constexpr auto operator"" _MiB(unsigned long long value) { return value * 1024 * 1024; }
  9. inline constexpr auto operator"" _GiB(unsigned long long value) { return value * 1024 * 1024 * 1024; }
  10. inline constexpr auto operator"" _TiB(unsigned long long value) { return value * 1024 * 1024 * 1024 * 1024; }
  11. inline constexpr auto operator"" _KHz(unsigned long long value) { return value * 1000; }
  12. inline constexpr auto operator"" _MHz(unsigned long long value) { return value * 1000 * 1000; }
  13. inline constexpr auto operator"" _GHz(unsigned long long value) { return value * 1000 * 1000 * 1000; }
  14. inline constexpr auto operator"" _THz(unsigned long long value) { return value * 1000 * 1000 * 1000 * 1000; }
  15. }