aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/tests/stdbit/stdc_bit_ceil_test.c
blob: 0495da55c5d9f18b7f961acd59b294546803ae45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright (c) 2025 Robert Clausecker <fuz@FreeBSD.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#define FUNCSTEM stdc_bit_ceil
#define MKREFFUNC(name, type)						\
	static type 							\
	name(type value) 						\
	{ 								\
		type ceil = 1;						\
									\
		while (ceil < value && ceil != 0)			\
			ceil <<= 1;					\
									\
		return (ceil);						\
	}

#include "stdbit-test-framework.c"