BaseTypes.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. static_assert(sizeof(char) == 1);
  10. static_assert(sizeof(float) == 4);
  11. static_assert(sizeof(int) >= 4);
  12. typedef unsigned char uchar;
  13. typedef signed char schar;
  14. typedef unsigned short ushort;
  15. typedef signed short sshort;
  16. #if !defined(CLANG_FIX_UINT_REDEF)
  17. typedef unsigned int uint;
  18. #endif
  19. typedef signed int sint;
  20. typedef unsigned long ulong;
  21. typedef signed long slong;
  22. typedef unsigned long long ulonglong;
  23. typedef signed long long slonglong;
  24. static_assert(sizeof(uchar) == sizeof(schar));
  25. static_assert(sizeof(ushort) == sizeof(sshort));
  26. static_assert(sizeof(uint) == sizeof(sint));
  27. static_assert(sizeof(ulong) == sizeof(slong));
  28. static_assert(sizeof(ulonglong) == sizeof(slonglong));
  29. static_assert(sizeof(uchar) <= sizeof(ushort));
  30. static_assert(sizeof(ushort) <= sizeof(uint));
  31. static_assert(sizeof(uint) <= sizeof(ulong));
  32. static_assert(sizeof(ulong) <= sizeof(ulonglong));
  33. typedef schar int8;
  34. typedef schar sint8;
  35. typedef uchar uint8;
  36. static_assert(sizeof(uint8) == 1);
  37. static_assert(sizeof(sint8) == 1);
  38. typedef sshort int16;
  39. typedef sshort sint16;
  40. typedef ushort uint16;
  41. static_assert(sizeof(uint16) == 2);
  42. static_assert(sizeof(sint16) == 2);
  43. typedef sint int32;
  44. typedef sint sint32;
  45. typedef uint uint32;
  46. static_assert(sizeof(uint32) == 4);
  47. static_assert(sizeof(sint32) == 4);
  48. typedef slonglong int64;
  49. #ifndef O3DE_INT64_DEFINED
  50. #define O3DE_INT64_DEFINED
  51. typedef slonglong sint64;
  52. typedef ulonglong uint64;
  53. static_assert(sizeof(uint64) == 8);
  54. static_assert(sizeof(sint64) == 8);
  55. #endif
  56. typedef float f32;
  57. typedef double f64;
  58. static_assert(sizeof(f32) == 4);
  59. static_assert(sizeof(f64) == 8);