This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#define DO_PRINT 0 | |
#define TEST_BITS(_n_, _do_print_) do { \ | |
unsigned calculated = number_of_set_bits(_n_); \ | |
unsigned actual = number_of_set_bits_naive(_n_); \ | |
if (_do_print_) \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#if defined(DEBUG) | |
#define PRINT(_fmt_, ...) printf(_fmt_, __VA_ARGS__); | |
#else | |
#define PRINT(_fmt_, ...) | |
#endif | |
/* works in the range: [0x1, 0x7FFF FFFF FFFF FFFF] */ | |
static size_t upper_power_of_two(size_t v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <net/if.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
struct if_nameindex *if_nidxs, *intf; | |
if (!(if_nidxs = if_nameindex())) | |
goto exit; |
OlderNewer