mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-18 13:04:36 +03:00
[Bug] Fixed constpool tests to not fail on big-endian machines
This commit is contained in:
@@ -280,12 +280,19 @@ UNIT(const_pool) {
|
|||||||
|
|
||||||
INFO("Checking if the constants were split into 4-byte patterns");
|
INFO("Checking if the constants were split into 4-byte patterns");
|
||||||
{
|
{
|
||||||
uint32_t c = 0x01010101;
|
uint32_t c = 0x01010101u;
|
||||||
for (i = 0; i < kCount; i++) {
|
size_t offset;
|
||||||
size_t offset;
|
|
||||||
EXPECT_EQ(pool.add(&c, 4, offset), kErrorOk);
|
EXPECT_EQ(pool.add(&c, 4, offset), kErrorOk);
|
||||||
EXPECT_EQ(offset, i * 8);
|
EXPECT_EQ(offset, 0);
|
||||||
|
|
||||||
|
// NOTE: We have to adjust the offset to successfully test this on big endian architectures.
|
||||||
|
size_t baseOffset = size_t(ASMJIT_ARCH_BE ? 4 : 0);
|
||||||
|
|
||||||
|
for (i = 1; i < kCount; i++) {
|
||||||
c++;
|
c++;
|
||||||
|
EXPECT_EQ(pool.add(&c, 4, offset), kErrorOk);
|
||||||
|
EXPECT_EQ(offset, baseOffset + i * 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user