Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/lib/libc/tests/stdbit/stdc_bit_floor_test.c
96309 views
1
/*
2
* Copyright (c) 2025 Robert Clausecker <[email protected]>
3
*
4
* SPDX-License-Identifier: BSD-2-Clause
5
*/
6
7
#define FUNCSTEM stdc_bit_floor
8
#define MKREFFUNC(name, type) \
9
static type \
10
name(type value) \
11
{ \
12
type floor = 1; \
13
\
14
if (value == 0) \
15
return (0); \
16
\
17
while (value != 1) { \
18
floor <<= 1; \
19
value >>= 1; \
20
} \
21
\
22
return (floor); \
23
}
24
25
#include "stdbit-test-framework.c"
26
27