Skip to content

Commit

Permalink
CacheLocalityTest.Basic on Windows
Browse files Browse the repository at this point in the history
Summary:
max_align_t is usually 8 on Windows, so fix this unit test which
assumes 16-byte alignment.

Reviewed By: Orvid

Differential Revision: D44726286

fbshipit-source-id: 3662000c4e55177d690d3aeb47fed817812ec893
  • Loading branch information
chadaustin authored and facebook-github-bot committed Apr 7, 2023
1 parent ad4ad70 commit 8c52d79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions folly/concurrency/test/CacheLocalityTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,11 +1150,13 @@ TEST(CoreAllocator, Basic) {
coreFree(res);

res = coreMalloc(8, kNumStripes, 0);
EXPECT_TRUE((intptr_t)res % 8 == 0); // check alignment
EXPECT_EQ(0, (intptr_t)res % 8); // check alignment
memset(res, 0, 8);
coreFree(res);
res = coreMalloc(12, kNumStripes, 0);
EXPECT_TRUE((intptr_t)res % 16 == 0); // check alignment
if (alignof(std::max_align_t) >= 16) {
EXPECT_EQ(0, (intptr_t)res % 16); // check alignment
}
memset(res, 0, 12);
coreFree(res);
res = coreMalloc(257, kNumStripes, 0);
Expand Down

0 comments on commit 8c52d79

Please sign in to comment.