Define fixed-width integer type aliases in terms of standard fixed-width types

This commit is contained in:
Chris Thrasher 2022-01-02 21:14:54 -07:00 committed by Lukas Dürrenberger
parent 79c2aadbcc
commit cd84b19669

View File

@ -26,6 +26,12 @@
#define SFML_CONFIG_HPP #define SFML_CONFIG_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cstdint>
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Define the SFML version // Define the SFML version
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -173,37 +179,21 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
namespace sf namespace sf
{ {
// All "common" platforms use the same size for char, short and int
// (basically there are 3 types for 3 sizes, so no other match is possible),
// we can use them without doing any kind of check
// 8 bits integer types // 8 bits integer types
using Int8 = signed char; using Int8 = std::int8_t;
using Uint8 = unsigned char; using Uint8 = std::uint8_t;
// 16 bits integer types // 16 bits integer types
using Int16 = short; using Int16 = std::int16_t;
using Uint16 = unsigned short; using Uint16 = std::uint16_t;
// 32 bits integer types // 32 bits integer types
using Int32 = int; using Int32 = std::int32_t;
using Uint32 = unsigned int; using Uint32 = std::uint32_t;
// 64 bits integer types // 64 bits integer types
#if defined(_MSC_VER) using Int64 = std::int64_t;
using Int64 = signed __int64; using Uint64 = std::uint64_t;
using Uint64 = unsigned __int64;
#else
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc++11-long-long"
#endif
using Int64 = long long;
using Uint64 = unsigned long long;
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#endif
} // namespace sf } // namespace sf