Fix Fletcher16 and CRC64

This commit is contained in:
Jérôme Leclercq 2023-09-08 13:40:30 +02:00 committed by GitHub
parent e8ddac4964
commit 18efb2016d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 9 deletions

View File

@ -93,9 +93,8 @@ namespace Nz
ByteArray CRC64Hasher::End() ByteArray CRC64Hasher::End()
{ {
#ifdef NAZARA_BIG_ENDIAN m_crc = BigEndianToHost(m_crc);
m_crc = ByteSwap(m_crc);
#endif
return ByteArray(reinterpret_cast<UInt8*>(&m_crc), 8); return ByteArray(reinterpret_cast<UInt8*>(&m_crc), 8);
} }

View File

@ -38,12 +38,7 @@ namespace Nz
m_sum1 = (m_sum1 & 0xFF) + (m_sum1 >> 8); m_sum1 = (m_sum1 & 0xFF) + (m_sum1 >> 8);
m_sum2 = (m_sum2 & 0xFF) + (m_sum2 >> 8); m_sum2 = (m_sum2 & 0xFF) + (m_sum2 >> 8);
UInt16 fletcher = (m_sum2 << 8) | m_sum1; UInt16 fletcher = BigEndianToHost((m_sum2 << 8) | m_sum1);
#ifdef NAZARA_BIG_ENDIAN
fletcher = ByteSwap(fletcher);
#endif
return ByteArray(reinterpret_cast<UInt8*>(&fletcher), 2); return ByteArray(reinterpret_cast<UInt8*>(&fletcher), 2);
} }