literals.h 644 B

123456789101112131415161718192021222324252627282930
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "common/common_types.h"
  5. namespace Common::Literals {
  6. constexpr u64 operator""_KiB(unsigned long long int x) {
  7. return 1024ULL * x;
  8. }
  9. constexpr u64 operator""_MiB(unsigned long long int x) {
  10. return 1024_KiB * x;
  11. }
  12. constexpr u64 operator""_GiB(unsigned long long int x) {
  13. return 1024_MiB * x;
  14. }
  15. constexpr u64 operator""_TiB(unsigned long long int x) {
  16. return 1024_GiB * x;
  17. }
  18. constexpr u64 operator""_PiB(unsigned long long int x) {
  19. return 1024_TiB * x;
  20. }
  21. } // namespace Common::Literals