view libutil/bitfunc.c @ 220:c798a1762c7c

smpp-test1: take strings on the command line, construct bind req
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 01 Aug 2023 23:29:38 -0800
parents 05d01e810217
children
line wrap: on
line source

/*
 * Some bit manipulation functions.
 */

#include <stdint.h>
#include "osmo_bits.h"

void uint16_to_bits(uint16_t word, ubit_t *out, unsigned nbits)
{
	unsigned n;

	for (n = 0; n < nbits; n++)
		out[n] = (word >> (nbits-n-1)) & 1;
}