Reformat the codebase with the clang-format 18.

This commit is contained in:
guangli-dai 2025-06-13 12:31:12 -07:00 committed by Guangli Dai
parent 0a6215c171
commit f1bba4a87c
346 changed files with 18286 additions and 17770 deletions

View file

@ -1,9 +1,8 @@
#include "test/jemalloc_test.h"
static const uint64_t smoothstep_tab[] = {
#define STEP(step, h, x, y) \
h,
SMOOTHSTEP
#define STEP(step, h, x, y) h,
SMOOTHSTEP
#undef STEP
};
@ -23,14 +22,14 @@ TEST_BEGIN(test_smoothstep_integral) {
sum += smoothstep_tab[i];
}
max = (KQU(1) << (SMOOTHSTEP_BFP-1)) * (SMOOTHSTEP_NSTEPS+1);
max = (KQU(1) << (SMOOTHSTEP_BFP - 1)) * (SMOOTHSTEP_NSTEPS + 1);
min = max - SMOOTHSTEP_NSTEPS;
expect_u64_ge(sum, min,
"Integral too small, even accounting for truncation");
expect_u64_ge(
sum, min, "Integral too small, even accounting for truncation");
expect_u64_le(sum, max, "Integral exceeds 1/2");
if (false) {
malloc_printf("%"FMTu64" ulps under 1/2 (limit %d)\n",
malloc_printf("%" FMTu64 " ulps under 1/2 (limit %d)\n",
max - sum, SMOOTHSTEP_NSTEPS);
}
}
@ -52,7 +51,7 @@ TEST_BEGIN(test_smoothstep_monotonic) {
expect_u64_ge(h, prev_h, "Piecewise non-monotonic, i=%u", i);
prev_h = h;
}
expect_u64_eq(smoothstep_tab[SMOOTHSTEP_NSTEPS-1],
expect_u64_eq(smoothstep_tab[SMOOTHSTEP_NSTEPS - 1],
(KQU(1) << SMOOTHSTEP_BFP), "Last step must equal 1");
}
TEST_END
@ -74,19 +73,21 @@ TEST_BEGIN(test_smoothstep_slope) {
uint64_t delta = h - prev_h;
expect_u64_ge(delta, prev_delta,
"Slope must monotonically increase in 0.0 <= x <= 0.5, "
"i=%u", i);
"i=%u",
i);
prev_h = h;
prev_delta = delta;
}
prev_h = KQU(1) << SMOOTHSTEP_BFP;
prev_delta = 0;
for (i = SMOOTHSTEP_NSTEPS-1; i >= SMOOTHSTEP_NSTEPS / 2; i--) {
for (i = SMOOTHSTEP_NSTEPS - 1; i >= SMOOTHSTEP_NSTEPS / 2; i--) {
uint64_t h = smoothstep_tab[i];
uint64_t delta = prev_h - h;
expect_u64_ge(delta, prev_delta,
"Slope must monotonically decrease in 0.5 <= x <= 1.0, "
"i=%u", i);
"i=%u",
i);
prev_h = h;
prev_delta = delta;
}
@ -95,8 +96,6 @@ TEST_END
int
main(void) {
return test(
test_smoothstep_integral,
test_smoothstep_monotonic,
return test(test_smoothstep_integral, test_smoothstep_monotonic,
test_smoothstep_slope);
}