Skip to content

Commit 224d792

Browse files
committed
chore: fix formatting of memalignment_test.cpp
1 parent 845184e commit 224d792

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

libc/test/src/stdlib/memalignment_test.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "src/stdlib/memalignment.h"
10-
#include "src/stdlib/malloc.h"
119
#include "src/stdlib/free.h"
10+
#include "src/stdlib/malloc.h"
11+
#include "src/stdlib/memalignment.h"
1212
#include "test/UnitTest/Test.h"
1313

1414
#include <stdint.h>
@@ -21,47 +21,47 @@ TEST(LlvmLibcMemAlignmentTest, NullPointer) {
2121
TEST(LlvmLibcMemAlignmentTest, MallocedPointers) {
2222
int *int_ptr = reinterpret_cast<int *>(LIBC_NAMESPACE::malloc(sizeof(int)));
2323
EXPECT_NE(reinterpret_cast<void *>(int_ptr), static_cast<void *>(nullptr));
24-
24+
2525
size_t int_alignment = LIBC_NAMESPACE::memalignment(int_ptr);
2626
EXPECT_GE(int_alignment, alignof(int));
27-
28-
27+
2928
LIBC_NAMESPACE::free(int_ptr);
30-
29+
3130
// Allocate a double (typically 8-byte aligned)
32-
double *double_ptr = reinterpret_cast<double *>(LIBC_NAMESPACE::malloc(sizeof(double)));
31+
double *double_ptr =
32+
reinterpret_cast<double *>(LIBC_NAMESPACE::malloc(sizeof(double)));
3333
EXPECT_NE(reinterpret_cast<void *>(double_ptr), static_cast<void *>(nullptr));
34-
34+
3535
size_t double_alignment = LIBC_NAMESPACE::memalignment(double_ptr);
3636
EXPECT_GE(double_alignment, alignof(double));
37-
37+
3838
EXPECT_EQ(double_alignment & (double_alignment - 1), static_cast<size_t>(0));
39-
39+
4040
LIBC_NAMESPACE::free(double_ptr);
4141
}
4242

4343
TEST(LlvmLibcMemAlignmentTest, SpecificAlignment) {
44-
44+
4545
// These addresses have known alignment patterns - if we can construct them
46-
uintptr_t addr_align2 = 0x2; // 2-byte aligned
47-
uintptr_t addr_align4 = 0x4; // 4-byte aligned
48-
uintptr_t addr_align8 = 0x8; // 8-byte aligned
49-
uintptr_t addr_align16 = 0x10; // 16-byte aligned
50-
uintptr_t addr_align32 = 0x20; // 32-byte aligned
51-
46+
uintptr_t addr_align2 = 0x2; // 2-byte aligned
47+
uintptr_t addr_align4 = 0x4; // 4-byte aligned
48+
uintptr_t addr_align8 = 0x8; // 8-byte aligned
49+
uintptr_t addr_align16 = 0x10; // 16-byte aligned
50+
uintptr_t addr_align32 = 0x20; // 32-byte aligned
51+
5252
void *ptr_align2 = reinterpret_cast<void *>(addr_align2);
5353
void *ptr_align4 = reinterpret_cast<void *>(addr_align4);
5454
void *ptr_align8 = reinterpret_cast<void *>(addr_align8);
5555
void *ptr_align16 = reinterpret_cast<void *>(addr_align16);
5656
void *ptr_align32 = reinterpret_cast<void *>(addr_align32);
57-
57+
5858
EXPECT_EQ(LIBC_NAMESPACE::memalignment(ptr_align2), static_cast<size_t>(2));
5959
EXPECT_EQ(LIBC_NAMESPACE::memalignment(ptr_align4), static_cast<size_t>(4));
6060
EXPECT_EQ(LIBC_NAMESPACE::memalignment(ptr_align8), static_cast<size_t>(8));
6161
EXPECT_EQ(LIBC_NAMESPACE::memalignment(ptr_align16), static_cast<size_t>(16));
6262
EXPECT_EQ(LIBC_NAMESPACE::memalignment(ptr_align32), static_cast<size_t>(32));
63-
64-
uintptr_t addr_complex = 0x1234560; // 16-byte aligned (ends in 0)
63+
64+
uintptr_t addr_complex = 0x1234560; // 16-byte aligned (ends in 0)
6565
void *ptr_complex = reinterpret_cast<void *>(addr_complex);
6666
EXPECT_EQ(LIBC_NAMESPACE::memalignment(ptr_complex), static_cast<size_t>(16));
6767
}

0 commit comments

Comments
 (0)