mirror of
https://github.com/opnsense/src.git
synced 2026-07-16 12:33:07 -04:00
This adds unit tests for all 70 functions in <stdbit.h>. I'm sorry for the test framework, but it makes it so I don't have to write 70 unit tests by hand. Reviewed by: adrian, des Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53660 (cherry picked from commit 2fb8cbc6ef1b3cc6cd60e5db07f8305623f9b044)
22 lines
438 B
C
22 lines
438 B
C
/*
|
|
* Copyright (c) 2025 Robert Clausecker <fuz@FreeBSD.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#define FUNCSTEM stdc_bit_width
|
|
#define MKREFFUNC(name, type) \
|
|
static unsigned \
|
|
name(type value) \
|
|
{ \
|
|
unsigned width = 0; \
|
|
\
|
|
while (value != 0) { \
|
|
value >>= 1; \
|
|
width++; \
|
|
} \
|
|
\
|
|
return (width); \
|
|
}
|
|
|
|
#include "stdbit-test-framework.c"
|