common_types.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-FileCopyrightText: 2012 Gekko Emulator
  2. // SPDX-FileContributor: ShizZy <shizzy247@gmail.com>
  3. // SPDX-License-Identifier: GPL-2.0-or-later
  4. /**
  5. * Copyright (C) 2005-2012 Gekko Emulator
  6. *
  7. * @file common_types.h
  8. * @author ShizZy <shizzy247@gmail.com>
  9. * @date 2012-02-11
  10. * @brief Common types used throughout the project
  11. *
  12. * @section LICENSE
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License as
  15. * published by the Free Software Foundation; either version 2 of
  16. * the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful, but
  19. * WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. * General Public License for more details at
  22. * http://www.gnu.org/copyleft/gpl.html
  23. *
  24. * Official project repository can be found at:
  25. * http://code.google.com/p/gekko-gc-emu/
  26. */
  27. #pragma once
  28. #include <array>
  29. #include <cstdint>
  30. using u8 = std::uint8_t; ///< 8-bit unsigned byte
  31. using u16 = std::uint16_t; ///< 16-bit unsigned short
  32. using u32 = std::uint32_t; ///< 32-bit unsigned word
  33. using u64 = std::uint64_t; ///< 64-bit unsigned int
  34. using s8 = std::int8_t; ///< 8-bit signed byte
  35. using s16 = std::int16_t; ///< 16-bit signed short
  36. using s32 = std::int32_t; ///< 32-bit signed word
  37. using s64 = std::int64_t; ///< 64-bit signed int
  38. using f32 = float; ///< 32-bit floating point
  39. using f64 = double; ///< 64-bit floating point
  40. using VAddr = u64; ///< Represents a pointer in the userspace virtual address space.
  41. using PAddr = u64; ///< Represents a pointer in the ARM11 physical address space.
  42. using GPUVAddr = u64; ///< Represents a pointer in the GPU virtual address space.
  43. using u128 = std::array<std::uint64_t, 2>;
  44. static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide");