summaryrefslogtreecommitdiff
path: root/gr-blocks/include/gnuradio/blocks/count_bits.h
blob: 9bfc61d98dbafa96ac5a4c25a703b4db4aa31d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* -*- c++ -*- */
/*
 * Copyright 2003,2013 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifndef _GR_COUNT_BITS_H_
#define _GR_COUNT_BITS_H_

#include <gnuradio/blocks/api.h>

namespace gr {
namespace blocks {

//! return number of set bits in the low  8 bits of x
BLOCKS_API unsigned int count_bits8(unsigned int x);

//! return number of set bits in the low 16 bits of x
BLOCKS_API unsigned int count_bits16(unsigned int x);

//! return number of set bits in the low 32 bits of x
BLOCKS_API unsigned int count_bits32(unsigned int x);

//! return number of set bits in a 64-bit word
BLOCKS_API unsigned int count_bits64(unsigned long long int x);

} /* namespace blocks */
} /* namespace gr */

#endif /* _GR_COUNT_BITS_H_ */