Replace sf::Int64 with std::int64_t

This commit is contained in:
Chris Thrasher 2022-09-12 15:44:40 -06:00 committed by Vittorio Romeo
parent b94df9e0d8
commit 05690b963d
28 changed files with 117 additions and 117 deletions

View File

@ -82,7 +82,7 @@ private:
// (don't forget that we run in two separate threads) // (don't forget that we run in two separate threads)
{ {
std::scoped_lock lock(m_mutex); std::scoped_lock lock(m_mutex);
m_tempBuffer.assign(m_samples.begin() + static_cast<std::vector<sf::Int64>::difference_type>(m_offset), m_tempBuffer.assign(m_samples.begin() + static_cast<std::vector<std::int64_t>::difference_type>(m_offset),
m_samples.end()); m_samples.end());
} }

View File

@ -239,7 +239,7 @@ protected:
/// \return The seek position after looping (or -1 if there's no loop) /// \return The seek position after looping (or -1 if there's no loop)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 onLoop() override; std::int64_t onLoop() override;
private: private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -249,7 +249,7 @@ protected:
/// \return The seek position after looping (or -1 if there's no loop) /// \return The seek position after looping (or -1 if there's no loop)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual Int64 onLoop(); virtual std::int64_t onLoop();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Set the processing interval /// \brief Set the processing interval
@ -347,7 +347,7 @@ private:
std::int32_t m_format; //!< Format of the internal sound buffers std::int32_t m_format; //!< Format of the internal sound buffers
bool m_loop; //!< Loop flag (true to loop, false to play once) bool m_loop; //!< Loop flag (true to loop, false to play once)
Uint64 m_samplesProcessed; //!< Number of samples processed since beginning of the stream Uint64 m_samplesProcessed; //!< Number of samples processed since beginning of the stream
Int64 m_bufferSeeks[BufferCount]; //!< If buffer is an "end buffer", holds next seek position, else NoLoop. For play offset calculation. std::int64_t m_bufferSeeks[BufferCount]; //!< If buffer is an "end buffer", holds next seek position, else NoLoop. For play offset calculation.
Time m_processingInterval; //!< Interval for checking and filling the internal sound buffers. Time m_processingInterval; //!< Interval for checking and filling the internal sound buffers.
}; };

View File

@ -168,7 +168,6 @@
namespace sf namespace sf
{ {
// 64 bits integer types // 64 bits integer types
using Int64 = std::int64_t;
using Uint64 = std::uint64_t; using Uint64 = std::uint64_t;
} // namespace sf } // namespace sf

View File

@ -243,7 +243,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \overload /// \overload
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Packet& operator>>(Int64& data); Packet& operator>>(std::int64_t& data);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \overload /// \overload
@ -324,7 +324,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \overload /// \overload
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Packet& operator<<(Int64 data); Packet& operator<<(std::int64_t data);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \overload /// \overload

View File

@ -114,7 +114,7 @@ public:
/// \return The number of bytes actually read, or -1 on error /// \return The number of bytes actually read, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] Int64 read(void* data, Int64 size) override; [[nodiscard]] std::int64_t read(void* data, std::int64_t size) override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Change the current reading position /// \brief Change the current reading position
@ -124,7 +124,7 @@ public:
/// \return The position actually sought to, or -1 on error /// \return The position actually sought to, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] Int64 seek(Int64 position) override; [[nodiscard]] std::int64_t seek(std::int64_t position) override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current reading position in the stream /// \brief Get the current reading position in the stream
@ -132,7 +132,7 @@ public:
/// \return The current position, or -1 on error. /// \return The current position, or -1 on error.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] Int64 tell() override; [[nodiscard]] std::int64_t tell() override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Return the size of the stream /// \brief Return the size of the stream
@ -140,7 +140,7 @@ public:
/// \return The total number of bytes available in the stream, or -1 on error /// \return The total number of bytes available in the stream, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 getSize() override; std::int64_t getSize() override;
private: private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -62,7 +62,7 @@ public:
/// \return The number of bytes actually read, or -1 on error /// \return The number of bytes actually read, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] virtual Int64 read(void* data, Int64 size) = 0; [[nodiscard]] virtual std::int64_t read(void* data, std::int64_t size) = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Change the current reading position /// \brief Change the current reading position
@ -72,7 +72,7 @@ public:
/// \return The position actually sought to, or -1 on error /// \return The position actually sought to, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] virtual Int64 seek(Int64 position) = 0; [[nodiscard]] virtual std::int64_t seek(std::int64_t position) = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current reading position in the stream /// \brief Get the current reading position in the stream
@ -80,7 +80,7 @@ public:
/// \return The current position, or -1 on error. /// \return The current position, or -1 on error.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] virtual Int64 tell() = 0; [[nodiscard]] virtual std::int64_t tell() = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Return the size of the stream /// \brief Return the size of the stream
@ -88,7 +88,7 @@ public:
/// \return The total number of bytes available in the stream, or -1 on error /// \return The total number of bytes available in the stream, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual Int64 getSize() = 0; virtual std::int64_t getSize() = 0;
}; };
} // namespace sf } // namespace sf
@ -123,13 +123,13 @@ public:
/// ///
/// [[nodiscard]] bool open(const std::filesystem::path& filename); /// [[nodiscard]] bool open(const std::filesystem::path& filename);
/// ///
/// [[nodiscard]] Int64 read(void* data, Int64 size); /// [[nodiscard]] std::int64_t read(void* data, std::int64_t size);
/// ///
/// [[nodiscard]] Int64 seek(Int64 position); /// [[nodiscard]] std::int64_t seek(std::int64_t position);
/// ///
/// [[nodiscard]] Int64 tell(); /// [[nodiscard]] std::int64_t tell();
/// ///
/// Int64 getSize(); /// std::int64_t getSize();
/// ///
/// private: /// private:
/// ///

View File

@ -73,7 +73,7 @@ public:
/// \return The number of bytes actually read, or -1 on error /// \return The number of bytes actually read, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] Int64 read(void* data, Int64 size) override; [[nodiscard]] std::int64_t read(void* data, std::int64_t size) override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Change the current reading position /// \brief Change the current reading position
@ -83,7 +83,7 @@ public:
/// \return The position actually sought to, or -1 on error /// \return The position actually sought to, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] Int64 seek(Int64 position) override; [[nodiscard]] std::int64_t seek(std::int64_t position) override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current reading position in the stream /// \brief Get the current reading position in the stream
@ -91,7 +91,7 @@ public:
/// \return The current position, or -1 on error. /// \return The current position, or -1 on error.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] Int64 tell() override; [[nodiscard]] std::int64_t tell() override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Return the size of the stream /// \brief Return the size of the stream
@ -99,15 +99,15 @@ public:
/// \return The total number of bytes available in the stream, or -1 on error /// \return The total number of bytes available in the stream, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 getSize() override; std::int64_t getSize() override;
private: private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
const char* m_data; //!< Pointer to the data in memory const char* m_data; //!< Pointer to the data in memory
Int64 m_size; //!< Total size of the data std::int64_t m_size; //!< Total size of the data
Int64 m_offset; //!< Current reading position std::int64_t m_offset; //!< Current reading position
}; };
} // namespace sf } // namespace sf

View File

@ -85,7 +85,7 @@ public:
/// \see asSeconds, asMilliseconds /// \see asSeconds, asMilliseconds
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Int64 asMicroseconds() const; constexpr std::int64_t asMicroseconds() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Return the time value as a std::chorono::duration /// \brief Return the time value as a std::chorono::duration
@ -112,7 +112,7 @@ public:
private: private:
friend constexpr Time seconds(float); friend constexpr Time seconds(float);
friend constexpr Time milliseconds(std::int32_t); friend constexpr Time milliseconds(std::int32_t);
friend constexpr Time microseconds(Int64); friend constexpr Time microseconds(std::int64_t);
private: private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -158,7 +158,7 @@ constexpr Time milliseconds(std::int32_t amount);
/// \see seconds, milliseconds /// \see seconds, milliseconds
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time microseconds(Int64 amount); constexpr Time microseconds(std::int64_t amount);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \relates Time /// \relates Time
@ -313,7 +313,7 @@ constexpr Time& operator-=(Time& left, Time right);
/// \return \a left multiplied by \a right /// \return \a left multiplied by \a right
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] constexpr Time operator*(Time left, Int64 right); [[nodiscard]] constexpr Time operator*(Time left, std::int64_t right);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \relates Time /// \relates Time
@ -337,7 +337,7 @@ constexpr Time& operator-=(Time& left, Time right);
/// \return \a left multiplied by \a right /// \return \a left multiplied by \a right
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] constexpr Time operator*(Int64 left, Time right); [[nodiscard]] constexpr Time operator*(std::int64_t left, Time right);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \relates Time /// \relates Time
@ -361,7 +361,7 @@ constexpr Time& operator*=(Time& left, float right);
/// \return \a left multiplied by \a right /// \return \a left multiplied by \a right
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time& operator*=(Time& left, Int64 right); constexpr Time& operator*=(Time& left, std::int64_t right);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \relates Time /// \relates Time
@ -385,7 +385,7 @@ constexpr Time& operator*=(Time& left, Int64 right);
/// \return \a left divided by \a right /// \return \a left divided by \a right
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
[[nodiscard]] constexpr Time operator/(Time left, Int64 right); [[nodiscard]] constexpr Time operator/(Time left, std::int64_t right);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \relates Time /// \relates Time
@ -409,7 +409,7 @@ constexpr Time& operator/=(Time& left, float right);
/// \return \a left divided by \a right /// \return \a left divided by \a right
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time& operator/=(Time& left, Int64 right); constexpr Time& operator/=(Time& left, std::int64_t right);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \relates Time /// \relates Time
@ -485,7 +485,7 @@ constexpr Time& operator%=(Time& left, Time right);
/// std::int32_t milli = t1.asMilliseconds(); // 100 /// std::int32_t milli = t1.asMilliseconds(); // 100
/// ///
/// sf::Time t2 = sf::milliseconds(30); /// sf::Time t2 = sf::milliseconds(30);
/// Int64 micro = t2.asMicroseconds(); // 30000 /// std::int64_t micro = t2.asMicroseconds(); // 30000
/// ///
/// sf::Time t3 = sf::microseconds(-800000); /// sf::Time t3 = sf::microseconds(-800000);
/// float sec = t3.asSeconds(); // -0.8 /// float sec = t3.asSeconds(); // -0.8

View File

@ -51,7 +51,7 @@ constexpr std::int32_t Time::asMilliseconds() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Int64 Time::asMicroseconds() const constexpr std::int64_t Time::asMicroseconds() const
{ {
return m_microseconds.count(); return m_microseconds.count();
} }
@ -87,7 +87,7 @@ constexpr Time milliseconds(std::int32_t amount)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time microseconds(Int64 amount) constexpr Time microseconds(std::int64_t amount)
{ {
return Time(std::chrono::microseconds(amount)); return Time(std::chrono::microseconds(amount));
} }
@ -178,7 +178,7 @@ constexpr Time operator*(Time left, float right)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time operator*(Time left, Int64 right) constexpr Time operator*(Time left, std::int64_t right)
{ {
return microseconds(left.asMicroseconds() * right); return microseconds(left.asMicroseconds() * right);
} }
@ -192,7 +192,7 @@ constexpr Time operator*(float left, Time right)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time operator*(Int64 left, Time right) constexpr Time operator*(std::int64_t left, Time right)
{ {
return right * left; return right * left;
} }
@ -206,7 +206,7 @@ constexpr Time& operator*=(Time& left, float right)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time& operator*=(Time& left, Int64 right) constexpr Time& operator*=(Time& left, std::int64_t right)
{ {
return left = left * right; return left = left * right;
} }
@ -220,7 +220,7 @@ constexpr Time operator/(Time left, float right)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time operator/(Time left, Int64 right) constexpr Time operator/(Time left, std::int64_t right)
{ {
return microseconds(left.asMicroseconds() / right); return microseconds(left.asMicroseconds() / right);
} }
@ -234,7 +234,7 @@ constexpr Time& operator/=(Time& left, float right)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
constexpr Time& operator/=(Time& left, Int64 right) constexpr Time& operator/=(Time& left, std::int64_t right)
{ {
return left = left / right; return left = left / right;
} }

View File

@ -214,7 +214,7 @@ void Music::onSeek(Time timeOffset)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 Music::onLoop() std::int64_t Music::onLoop()
{ {
// Called by underlying SoundStream so we can determine where to loop. // Called by underlying SoundStream so we can determine where to loop.
std::scoped_lock lock(m_mutex); std::scoped_lock lock(m_mutex);
@ -224,7 +224,7 @@ Int64 Music::onLoop()
// Looping is enabled, and either we're at the loop end, or we're at the EOF // Looping is enabled, and either we're at the loop end, or we're at the EOF
// when it's equivalent to the loop end (loop end takes priority). Send us to loop begin // when it's equivalent to the loop end (loop end takes priority). Send us to loop begin
m_file.seek(m_loopSpan.offset); m_file.seek(m_loopSpan.offset);
return static_cast<Int64>(m_file.getSampleOffset()); return static_cast<std::int64_t>(m_file.getSampleOffset());
} }
else if (getLoop() && (currentOffset >= m_file.getSampleCount())) else if (getLoop() && (currentOffset >= m_file.getSampleCount()))
{ {
@ -256,7 +256,7 @@ Uint64 Music::timeToSamples(Time position) const
// Always ROUND, no unchecked truncation, hence the addition in the numerator. // Always ROUND, no unchecked truncation, hence the addition in the numerator.
// This avoids most precision errors arising from "samples => Time => samples" conversions // This avoids most precision errors arising from "samples => Time => samples" conversions
// Original rounding calculation is ((Micros * Freq * Channels) / 1000000) + 0.5 // Original rounding calculation is ((Micros * Freq * Channels) / 1000000) + 0.5
// We refactor it to keep Int64 as the data type throughout the whole operation. // We refactor it to keep std::int64_t as the data type throughout the whole operation.
return ((static_cast<Uint64>(position.asMicroseconds()) * getSampleRate() * getChannelCount()) + 500000) / 1000000; return ((static_cast<Uint64>(position.asMicroseconds()) * getSampleRate() * getChannelCount()) + 500000) / 1000000;
} }
@ -268,7 +268,7 @@ Time Music::samplesToTime(Uint64 samples) const
// Make sure we don't divide by 0 // Make sure we don't divide by 0
if (getSampleRate() != 0 && getChannelCount() != 0) if (getSampleRate() != 0 && getChannelCount() != 0)
position = microseconds(static_cast<Int64>((samples * 1000000) / (getChannelCount() * getSampleRate()))); position = microseconds(static_cast<std::int64_t>((samples * 1000000) / (getChannelCount() * getSampleRate())));
return position; return position;
} }

View File

@ -39,7 +39,7 @@ FLAC__StreamDecoderReadStatus streamRead(const FLAC__StreamDecoder*, FLAC__byte
{ {
auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData); auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData);
sf::Int64 count = data->stream->read(buffer, static_cast<sf::Int64>(*bytes)); std::int64_t count = data->stream->read(buffer, static_cast<std::int64_t>(*bytes));
if (count > 0) if (count > 0)
{ {
*bytes = static_cast<std::size_t>(count); *bytes = static_cast<std::size_t>(count);
@ -59,7 +59,7 @@ FLAC__StreamDecoderSeekStatus streamSeek(const FLAC__StreamDecoder*, FLAC__uint6
{ {
auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData); auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData);
sf::Int64 position = data->stream->seek(static_cast<sf::Int64>(absoluteByteOffset)); std::int64_t position = data->stream->seek(static_cast<std::int64_t>(absoluteByteOffset));
if (position >= 0) if (position >= 0)
return FLAC__STREAM_DECODER_SEEK_STATUS_OK; return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
else else
@ -70,7 +70,7 @@ FLAC__StreamDecoderTellStatus streamTell(const FLAC__StreamDecoder*, FLAC__uint6
{ {
auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData); auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData);
sf::Int64 position = data->stream->tell(); std::int64_t position = data->stream->tell();
if (position >= 0) if (position >= 0)
{ {
*absoluteByteOffset = static_cast<FLAC__uint64>(position); *absoluteByteOffset = static_cast<FLAC__uint64>(position);
@ -86,7 +86,7 @@ FLAC__StreamDecoderLengthStatus streamLength(const FLAC__StreamDecoder*, FLAC__u
{ {
auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData); auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData);
sf::Int64 count = data->stream->getSize(); std::int64_t count = data->stream->getSize();
if (count >= 0) if (count >= 0)
{ {
*streamLength = static_cast<FLAC__uint64>(count); *streamLength = static_cast<FLAC__uint64>(count);

View File

@ -57,13 +57,13 @@ namespace
std::size_t readCallback(void* ptr, std::size_t size, void* data) std::size_t readCallback(void* ptr, std::size_t size, void* data)
{ {
sf::InputStream* stream = static_cast<sf::InputStream*>(data); sf::InputStream* stream = static_cast<sf::InputStream*>(data);
return static_cast<std::size_t>(stream->read(ptr, static_cast<sf::Int64>(size))); return static_cast<std::size_t>(stream->read(ptr, static_cast<std::int64_t>(size)));
} }
int seekCallback(std::uint64_t offset, void* data) int seekCallback(std::uint64_t offset, void* data)
{ {
sf::InputStream* stream = static_cast<sf::InputStream*>(data); sf::InputStream* stream = static_cast<sf::InputStream*>(data);
sf::Int64 position = stream->seek(static_cast<sf::Int64>(offset)); std::int64_t position = stream->seek(static_cast<std::int64_t>(offset));
return position < 0 ? -1 : 0; return position < 0 ? -1 : 0;
} }
@ -83,7 +83,7 @@ bool SoundFileReaderMp3::check(InputStream& stream)
{ {
std::uint8_t header[10]; std::uint8_t header[10];
if (static_cast<std::size_t>(stream.read(header, static_cast<Int64>(sizeof(header)))) < sizeof(header)) if (static_cast<std::size_t>(stream.read(header, static_cast<std::int64_t>(sizeof(header)))) < sizeof(header))
return false; return false;
if (hasValidId3Tag(header)) if (hasValidId3Tag(header))

View File

@ -39,7 +39,7 @@ namespace
std::size_t read(void* ptr, std::size_t size, std::size_t nmemb, void* data) std::size_t read(void* ptr, std::size_t size, std::size_t nmemb, void* data)
{ {
auto* stream = static_cast<sf::InputStream*>(data); auto* stream = static_cast<sf::InputStream*>(data);
return static_cast<std::size_t>(stream->read(ptr, static_cast<sf::Int64>(size * nmemb))); return static_cast<std::size_t>(stream->read(ptr, static_cast<std::int64_t>(size * nmemb)));
} }
int seek(void* data, ogg_int64_t offset, int whence) int seek(void* data, ogg_int64_t offset, int whence)

View File

@ -49,7 +49,7 @@ bool decode(sf::InputStream& stream, std::uint8_t& value)
bool decode(sf::InputStream& stream, std::int16_t& value) bool decode(sf::InputStream& stream, std::int16_t& value)
{ {
unsigned char bytes[sizeof(value)]; unsigned char bytes[sizeof(value)];
if (static_cast<std::size_t>(stream.read(bytes, static_cast<sf::Int64>(sizeof(bytes)))) != sizeof(bytes)) if (static_cast<std::size_t>(stream.read(bytes, static_cast<std::int64_t>(sizeof(bytes)))) != sizeof(bytes))
return false; return false;
value = static_cast<std::int16_t>(bytes[0] | (bytes[1] << 8)); value = static_cast<std::int16_t>(bytes[0] | (bytes[1] << 8));
@ -60,7 +60,7 @@ bool decode(sf::InputStream& stream, std::int16_t& value)
bool decode(sf::InputStream& stream, std::uint16_t& value) bool decode(sf::InputStream& stream, std::uint16_t& value)
{ {
unsigned char bytes[sizeof(value)]; unsigned char bytes[sizeof(value)];
if (static_cast<std::size_t>(stream.read(bytes, static_cast<sf::Int64>(sizeof(bytes)))) != sizeof(bytes)) if (static_cast<std::size_t>(stream.read(bytes, static_cast<std::int64_t>(sizeof(bytes)))) != sizeof(bytes))
return false; return false;
value = static_cast<std::uint16_t>(bytes[0] | (bytes[1] << 8)); value = static_cast<std::uint16_t>(bytes[0] | (bytes[1] << 8));
@ -71,7 +71,7 @@ bool decode(sf::InputStream& stream, std::uint16_t& value)
bool decode24bit(sf::InputStream& stream, std::uint32_t& value) bool decode24bit(sf::InputStream& stream, std::uint32_t& value)
{ {
unsigned char bytes[3]; unsigned char bytes[3];
if (static_cast<std::size_t>(stream.read(bytes, static_cast<sf::Int64>(sizeof(bytes)))) != sizeof(bytes)) if (static_cast<std::size_t>(stream.read(bytes, static_cast<std::int64_t>(sizeof(bytes)))) != sizeof(bytes))
return false; return false;
value = static_cast<std::uint32_t>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16)); value = static_cast<std::uint32_t>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16));
@ -82,7 +82,7 @@ bool decode24bit(sf::InputStream& stream, std::uint32_t& value)
bool decode(sf::InputStream& stream, std::uint32_t& value) bool decode(sf::InputStream& stream, std::uint32_t& value)
{ {
unsigned char bytes[sizeof(value)]; unsigned char bytes[sizeof(value)];
if (static_cast<std::size_t>(stream.read(bytes, static_cast<sf::Int64>(sizeof(bytes)))) != sizeof(bytes)) if (static_cast<std::size_t>(stream.read(bytes, static_cast<std::int64_t>(sizeof(bytes)))) != sizeof(bytes))
return false; return false;
value = static_cast<std::uint32_t>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24)); value = static_cast<std::uint32_t>(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24));
@ -109,7 +109,7 @@ namespace priv
bool SoundFileReaderWav::check(InputStream& stream) bool SoundFileReaderWav::check(InputStream& stream)
{ {
char header[mainChunkSize]; char header[mainChunkSize];
if (stream.read(header, sizeof(header)) < static_cast<Int64>(sizeof(header))) if (stream.read(header, sizeof(header)) < static_cast<std::int64_t>(sizeof(header)))
return false; return false;
return (header[0] == 'R') && (header[1] == 'I') && (header[2] == 'F') && (header[3] == 'F') && (header[8] == 'W') && return (header[0] == 'R') && (header[1] == 'I') && (header[2] == 'F') && (header[3] == 'F') && (header[8] == 'W') &&
@ -143,7 +143,7 @@ void SoundFileReaderWav::seek(Uint64 sampleOffset)
{ {
assert(m_stream); assert(m_stream);
if (m_stream->seek(static_cast<Int64>(m_dataStart + sampleOffset * m_bytesPerSample) == -1)) if (m_stream->seek(static_cast<std::int64_t>(m_dataStart + sampleOffset * m_bytesPerSample) == -1))
err() << "Failed to seek WAV sound stream" << std::endl; err() << "Failed to seek WAV sound stream" << std::endl;
} }
@ -224,7 +224,8 @@ bool SoundFileReaderWav::parseHeader(Info& info)
// If we are here, it means that the first part of the header // If we are here, it means that the first part of the header
// (the format) has already been checked // (the format) has already been checked
char mainChunk[mainChunkSize]; char mainChunk[mainChunkSize];
if (static_cast<std::size_t>(m_stream->read(mainChunk, static_cast<Int64>(sizeof(mainChunk)))) != sizeof(mainChunk)) if (static_cast<std::size_t>(m_stream->read(mainChunk, static_cast<std::int64_t>(sizeof(mainChunk)))) !=
sizeof(mainChunk))
return false; return false;
// Parse all the sub-chunks // Parse all the sub-chunks
@ -233,13 +234,13 @@ bool SoundFileReaderWav::parseHeader(Info& info)
{ {
// Parse the sub-chunk id and size // Parse the sub-chunk id and size
char subChunkId[4]; char subChunkId[4];
if (static_cast<std::size_t>(m_stream->read(subChunkId, static_cast<Int64>(sizeof(subChunkId)))) != if (static_cast<std::size_t>(m_stream->read(subChunkId, static_cast<std::int64_t>(sizeof(subChunkId)))) !=
sizeof(subChunkId)) sizeof(subChunkId))
return false; return false;
std::uint32_t subChunkSize = 0; std::uint32_t subChunkSize = 0;
if (!decode(*m_stream, subChunkSize)) if (!decode(*m_stream, subChunkSize))
return false; return false;
Int64 subChunkStart = m_stream->tell(); std::int64_t subChunkStart = m_stream->tell();
if (subChunkStart == -1) if (subChunkStart == -1)
return false; return false;
@ -308,7 +309,7 @@ bool SoundFileReaderWav::parseHeader(Info& info)
// Subformat // Subformat
char subformat[16]; char subformat[16];
if (static_cast<std::size_t>(m_stream->read(subformat, static_cast<Int64>(sizeof(subformat)))) != if (static_cast<std::size_t>(m_stream->read(subformat, static_cast<std::int64_t>(sizeof(subformat)))) !=
sizeof(subformat)) sizeof(subformat))
return false; return false;

View File

@ -260,7 +260,7 @@ bool SoundStream::getLoop() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 SoundStream::onLoop() std::int64_t SoundStream::onLoop()
{ {
onSeek(Time::Zero); onSeek(Time::Zero);
return 0; return 0;
@ -290,7 +290,7 @@ void SoundStream::streamData()
// Create the buffers // Create the buffers
alCheck(alGenBuffers(BufferCount, m_buffers)); alCheck(alGenBuffers(BufferCount, m_buffers));
for (Int64& bufferSeek : m_bufferSeeks) for (std::int64_t& bufferSeek : m_bufferSeeks)
bufferSeek = NoLoop; bufferSeek = NoLoop;
// Fill the queue // Fill the queue

View File

@ -53,12 +53,13 @@ namespace
// FreeType callbacks that operate on a sf::InputStream // FreeType callbacks that operate on a sf::InputStream
unsigned long read(FT_Stream rec, unsigned long offset, unsigned char* buffer, unsigned long count) unsigned long read(FT_Stream rec, unsigned long offset, unsigned char* buffer, unsigned long count)
{ {
auto convertedOffset = static_cast<sf::Int64>(offset); auto convertedOffset = static_cast<std::int64_t>(offset);
auto* stream = static_cast<sf::InputStream*>(rec->descriptor.pointer); auto* stream = static_cast<sf::InputStream*>(rec->descriptor.pointer);
if (stream->seek(convertedOffset) == convertedOffset) if (stream->seek(convertedOffset) == convertedOffset)
{ {
if (count > 0) if (count > 0)
return static_cast<unsigned long>(stream->read(reinterpret_cast<char*>(buffer), static_cast<sf::Int64>(count))); return static_cast<unsigned long>(
stream->read(reinterpret_cast<char*>(buffer), static_cast<std::int64_t>(count)));
else else
return 0; return 0;
} }

View File

@ -102,8 +102,8 @@ bool getFileContents(const std::filesystem::path& filename, std::vector<char>& b
// Read the contents of a stream into an array of char // Read the contents of a stream into an array of char
bool getStreamContents(sf::InputStream& stream, std::vector<char>& buffer) bool getStreamContents(sf::InputStream& stream, std::vector<char>& buffer)
{ {
bool success = true; bool success = true;
sf::Int64 size = stream.getSize(); std::int64_t size = stream.getSize();
if (size > 0) if (size > 0)
{ {
buffer.resize(static_cast<std::size_t>(size)); buffer.resize(static_cast<std::size_t>(size));
@ -114,8 +114,8 @@ bool getStreamContents(sf::InputStream& stream, std::vector<char>& buffer)
return false; return false;
} }
sf::Int64 read = stream.read(buffer.data(), size); std::int64_t read = stream.read(buffer.data(), size);
success = (read == size); success = (read == size);
} }
buffer.push_back('\0'); buffer.push_back('\0');
return success; return success;

View File

@ -211,7 +211,7 @@ Packet& Packet::operator>>(std::uint32_t& data)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Packet& Packet::operator>>(Int64& data) Packet& Packet::operator>>(std::int64_t& data)
{ {
if (checkSize(sizeof(data))) if (checkSize(sizeof(data)))
{ {
@ -220,10 +220,10 @@ Packet& Packet::operator>>(Int64& data)
std::uint8_t bytes[sizeof(data)]; std::uint8_t bytes[sizeof(data)];
std::memcpy(bytes, &m_data[m_readPos], sizeof(data)); std::memcpy(bytes, &m_data[m_readPos], sizeof(data));
data = (static_cast<Int64>(bytes[0]) << 56) | (static_cast<Int64>(bytes[1]) << 48) | data = (static_cast<std::int64_t>(bytes[0]) << 56) | (static_cast<std::int64_t>(bytes[1]) << 48) |
(static_cast<Int64>(bytes[2]) << 40) | (static_cast<Int64>(bytes[3]) << 32) | (static_cast<std::int64_t>(bytes[2]) << 40) | (static_cast<std::int64_t>(bytes[3]) << 32) |
(static_cast<Int64>(bytes[4]) << 24) | (static_cast<Int64>(bytes[5]) << 16) | (static_cast<std::int64_t>(bytes[4]) << 24) | (static_cast<std::int64_t>(bytes[5]) << 16) |
(static_cast<Int64>(bytes[6]) << 8) | (static_cast<Int64>(bytes[7])); (static_cast<std::int64_t>(bytes[6]) << 8) | (static_cast<std::int64_t>(bytes[7]));
m_readPos += sizeof(data); m_readPos += sizeof(data);
} }
@ -452,7 +452,7 @@ Packet& Packet::operator<<(std::uint32_t data)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Packet& Packet::operator<<(Int64 data) Packet& Packet::operator<<(std::int64_t data)
{ {
// Since htonll is not available everywhere, we have to convert // Since htonll is not available everywhere, we have to convert
// to network byte order (big endian) manually // to network byte order (big endian) manually

View File

@ -57,7 +57,7 @@ ResourceStream::~ResourceStream()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 ResourceStream::read(void* data, Int64 size) std::int64_t ResourceStream::read(void* data, std::int64_t size)
{ {
if (m_file) if (m_file)
{ {
@ -71,7 +71,7 @@ Int64 ResourceStream::read(void* data, Int64 size)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 ResourceStream::seek(Int64 position) std::int64_t ResourceStream::seek(std::int64_t position)
{ {
if (m_file) if (m_file)
{ {
@ -85,7 +85,7 @@ Int64 ResourceStream::seek(Int64 position)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 ResourceStream::tell() std::int64_t ResourceStream::tell()
{ {
if (m_file) if (m_file)
{ {
@ -99,7 +99,7 @@ Int64 ResourceStream::tell()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 ResourceStream::getSize() std::int64_t ResourceStream::getSize()
{ {
if (m_file) if (m_file)
{ {

View File

@ -72,7 +72,7 @@ public:
/// \return The number of bytes actually read, or -1 on error /// \return The number of bytes actually read, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 read(void* data, Int64 size) override; std::int64_t read(void* data, std::int64_t size) override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Change the current reading position in the asset file /// \brief Change the current reading position in the asset file
@ -82,7 +82,7 @@ public:
/// \return The position actually sought to, or -1 on error /// \return The position actually sought to, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 seek(Int64 position) override; std::int64_t seek(std::int64_t position) override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current reading position in the asset file /// \brief Get the current reading position in the asset file
@ -90,7 +90,7 @@ public:
/// \return The current position, or -1 on error. /// \return The current position, or -1 on error.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 tell() override; std::int64_t tell() override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Return the size of the asset file /// \brief Return the size of the asset file
@ -98,7 +98,7 @@ public:
/// \return The total number of bytes available in the asset, or -1 on error /// \return The total number of bytes available in the asset, or -1 on error
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 getSize() override; std::int64_t getSize() override;
private: private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -77,13 +77,13 @@ bool FileInputStream::open(const std::filesystem::path& filename)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::read(void* data, Int64 size) std::int64_t FileInputStream::read(void* data, std::int64_t size)
{ {
#ifdef SFML_SYSTEM_ANDROID #ifdef SFML_SYSTEM_ANDROID
return m_file->read(data, size); return m_file->read(data, size);
#else #else
if (m_file) if (m_file)
return static_cast<Int64>(std::fread(data, 1, static_cast<std::size_t>(size), m_file.get())); return static_cast<std::int64_t>(std::fread(data, 1, static_cast<std::size_t>(size), m_file.get()));
else else
return -1; return -1;
#endif #endif
@ -91,7 +91,7 @@ Int64 FileInputStream::read(void* data, Int64 size)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::seek(Int64 position) std::int64_t FileInputStream::seek(std::int64_t position)
{ {
#ifdef SFML_SYSTEM_ANDROID #ifdef SFML_SYSTEM_ANDROID
return m_file->seek(position); return m_file->seek(position);
@ -112,7 +112,7 @@ Int64 FileInputStream::seek(Int64 position)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::tell() std::int64_t FileInputStream::tell()
{ {
#ifdef SFML_SYSTEM_ANDROID #ifdef SFML_SYSTEM_ANDROID
return m_file->tell(); return m_file->tell();
@ -126,16 +126,16 @@ Int64 FileInputStream::tell()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 FileInputStream::getSize() std::int64_t FileInputStream::getSize()
{ {
#ifdef SFML_SYSTEM_ANDROID #ifdef SFML_SYSTEM_ANDROID
return m_file->getSize(); return m_file->getSize();
#else #else
if (m_file) if (m_file)
{ {
Int64 position = tell(); std::int64_t position = tell();
std::fseek(m_file.get(), 0, SEEK_END); std::fseek(m_file.get(), 0, SEEK_END);
Int64 size = tell(); std::int64_t size = tell();
if (seek(position) == -1) if (seek(position) == -1)
return -1; return -1;

View File

@ -42,19 +42,19 @@ MemoryInputStream::MemoryInputStream() : m_data(nullptr), m_size(0), m_offset(0)
void MemoryInputStream::open(const void* data, std::size_t sizeInBytes) void MemoryInputStream::open(const void* data, std::size_t sizeInBytes)
{ {
m_data = static_cast<const char*>(data); m_data = static_cast<const char*>(data);
m_size = static_cast<Int64>(sizeInBytes); m_size = static_cast<std::int64_t>(sizeInBytes);
m_offset = 0; m_offset = 0;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 MemoryInputStream::read(void* data, Int64 size) std::int64_t MemoryInputStream::read(void* data, std::int64_t size)
{ {
if (!m_data) if (!m_data)
return -1; return -1;
Int64 endPosition = m_offset + size; std::int64_t endPosition = m_offset + size;
Int64 count = endPosition <= m_size ? size : m_size - m_offset; std::int64_t count = endPosition <= m_size ? size : m_size - m_offset;
if (count > 0) if (count > 0)
{ {
@ -67,7 +67,7 @@ Int64 MemoryInputStream::read(void* data, Int64 size)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 MemoryInputStream::seek(Int64 position) std::int64_t MemoryInputStream::seek(std::int64_t position)
{ {
if (!m_data) if (!m_data)
return -1; return -1;
@ -78,7 +78,7 @@ Int64 MemoryInputStream::seek(Int64 position)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 MemoryInputStream::tell() std::int64_t MemoryInputStream::tell()
{ {
if (!m_data) if (!m_data)
return -1; return -1;
@ -88,7 +88,7 @@ Int64 MemoryInputStream::tell()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Int64 MemoryInputStream::getSize() std::int64_t MemoryInputStream::getSize()
{ {
if (!m_data) if (!m_data)
return -1; return -1;

View File

@ -37,7 +37,7 @@ namespace sf::priv
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void sleepImpl(Time time) void sleepImpl(Time time)
{ {
const Int64 usecs = time.asMicroseconds(); const std::int64_t usecs = time.asMicroseconds();
// Construct the time to wait // Construct the time to wait
timespec ti; timespec ti;

View File

@ -341,8 +341,8 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
} }
// Retrieve everything we need to create this MotionEvent in Java // Retrieve everything we need to create this MotionEvent in Java
Int64 downTime = AMotionEvent_getDownTime(_event); std::int64_t downTime = AMotionEvent_getDownTime(_event);
Int64 eventTime = AMotionEvent_getEventTime(_event); std::int64_t eventTime = AMotionEvent_getEventTime(_event);
std::int32_t action = AMotionEvent_getAction(_event); std::int32_t action = AMotionEvent_getAction(_event);
float x = AMotionEvent_getX(_event, 0); float x = AMotionEvent_getX(_event, 0);
float y = AMotionEvent_getY(_event, 0); float y = AMotionEvent_getY(_event, 0);

View File

@ -42,12 +42,12 @@ TEST_CASE("sf::Packet class - [network]")
testPacketStreamOperators(std::numeric_limits<std::int32_t>::max()); testPacketStreamOperators(std::numeric_limits<std::int32_t>::max());
} }
SUBCASE("Int64") SUBCASE("std::int64_t")
{ {
testPacketStreamOperators(sf::Int64(0)); testPacketStreamOperators(std::int64_t(0));
testPacketStreamOperators(sf::Int64(1)); testPacketStreamOperators(std::int64_t(1));
testPacketStreamOperators(std::numeric_limits<sf::Int64>::min()); testPacketStreamOperators(std::numeric_limits<std::int64_t>::min());
testPacketStreamOperators(std::numeric_limits<sf::Int64>::max()); testPacketStreamOperators(std::numeric_limits<std::int64_t>::max());
} }
} }
} }

View File

@ -14,7 +14,6 @@ TEST_CASE("SFML/Config.hpp")
SUBCASE("Fixed width types") SUBCASE("Fixed width types")
{ {
CHECK(sizeof(sf::Int64) == 8);
CHECK(sizeof(sf::Uint64) == 8); CHECK(sizeof(sf::Uint64) == 8);
} }
} }

View File

@ -236,18 +236,18 @@ TEST_CASE("sf::Time class - [system]")
{ {
CHECK(sf::seconds(1) * 2.0f == sf::seconds(2)); CHECK(sf::seconds(1) * 2.0f == sf::seconds(2));
CHECK(sf::seconds(12) * 0.5f == sf::seconds(6)); CHECK(sf::seconds(12) * 0.5f == sf::seconds(6));
CHECK(sf::seconds(1) * static_cast<sf::Int64>(2) == sf::seconds(2)); CHECK(sf::seconds(1) * static_cast<std::int64_t>(2) == sf::seconds(2));
CHECK(sf::seconds(42) * static_cast<sf::Int64>(2) == sf::seconds(84)); CHECK(sf::seconds(42) * static_cast<std::int64_t>(2) == sf::seconds(84));
CHECK(2.0f * sf::seconds(1) == sf::seconds(2)); CHECK(2.0f * sf::seconds(1) == sf::seconds(2));
CHECK(0.5f * sf::seconds(12) == sf::seconds(6)); CHECK(0.5f * sf::seconds(12) == sf::seconds(6));
CHECK(static_cast<sf::Int64>(2) * sf::seconds(1) == sf::seconds(2)); CHECK(static_cast<std::int64_t>(2) * sf::seconds(1) == sf::seconds(2));
CHECK(static_cast<sf::Int64>(2) * sf::seconds(42) == sf::seconds(84)); CHECK(static_cast<std::int64_t>(2) * sf::seconds(42) == sf::seconds(84));
} }
SUBCASE("operator*=") SUBCASE("operator*=")
{ {
sf::Time time = sf::milliseconds(1'000); sf::Time time = sf::milliseconds(1'000);
time *= static_cast<sf::Int64>(10); time *= static_cast<std::int64_t>(10);
CHECK(time == sf::milliseconds(10'000)); CHECK(time == sf::milliseconds(10'000));
time *= 0.1f; time *= 0.1f;
CHECK(time.asMilliseconds() == 1'000); CHECK(time.asMilliseconds() == 1'000);
@ -257,8 +257,8 @@ TEST_CASE("sf::Time class - [system]")
{ {
CHECK(sf::seconds(1) / 2.0f == sf::seconds(0.5f)); CHECK(sf::seconds(1) / 2.0f == sf::seconds(0.5f));
CHECK(sf::seconds(12) / 0.5f == sf::seconds(24)); CHECK(sf::seconds(12) / 0.5f == sf::seconds(24));
CHECK(sf::seconds(1) / static_cast<sf::Int64>(2) == sf::seconds(0.5f)); CHECK(sf::seconds(1) / static_cast<std::int64_t>(2) == sf::seconds(0.5f));
CHECK(sf::seconds(42) / static_cast<sf::Int64>(2) == sf::seconds(21)); CHECK(sf::seconds(42) / static_cast<std::int64_t>(2) == sf::seconds(21));
CHECK(sf::seconds(1) / sf::seconds(1) == 1.0f); CHECK(sf::seconds(1) / sf::seconds(1) == 1.0f);
CHECK(sf::milliseconds(10) / sf::microseconds(1) == Approx(10'000.f)); CHECK(sf::milliseconds(10) / sf::microseconds(1) == Approx(10'000.f));
} }
@ -266,7 +266,7 @@ TEST_CASE("sf::Time class - [system]")
SUBCASE("operator/=") SUBCASE("operator/=")
{ {
sf::Time time = sf::milliseconds(1'000); sf::Time time = sf::milliseconds(1'000);
time /= static_cast<sf::Int64>(2); time /= static_cast<std::int64_t>(2);
CHECK(time == sf::milliseconds(500)); CHECK(time == sf::milliseconds(500));
time /= 0.5f; time /= 0.5f;
CHECK(time.asMilliseconds() == 1'000); CHECK(time.asMilliseconds() == 1'000);