GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
log2_const.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2006,2013 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23
24/*
25 * a bit of template hackery...
26 */
27#ifndef INCLUDED_BLOCKS_LOG2_CONST_H
28#define INCLUDED_BLOCKS_LOG2_CONST_H
29
30#include <gnuradio/blocks/api.h>
31#include <assert.h>
32
33namespace gr {
34namespace blocks {
35
36template <unsigned int k>
37static inline int log2_const()
38{
39 assert(0);
40 return 0;
41}
42
43template <>
44inline int log2_const<1>()
45{
46 return 0;
47}
48template <>
49inline int log2_const<2>()
50{
51 return 1;
52}
53template <>
54inline int log2_const<4>()
55{
56 return 2;
57}
58template <>
59inline int log2_const<8>()
60{
61 return 3;
62}
63template <>
64inline int log2_const<16>()
65{
66 return 4;
67}
68template <>
69inline int log2_const<32>()
70{
71 return 5;
72}
73template <>
74inline int log2_const<64>()
75{
76 return 6;
77}
78template <>
79inline int log2_const<128>()
80{
81 return 7;
82}
83template <>
84inline int log2_const<256>()
85{
86 return 8;
87}
88template <>
89inline int log2_const<512>()
90{
91 return 9;
92}
93template <>
94inline int log2_const<1024>()
95{
96 return 10;
97}
98
99} /* namespace blocks */
100} /* namespace gr */
101
102#endif /* INCLUDED_BLOCKS_LOG2_CONST_H */
int log2_const< 1 >()
Definition log2_const.h:44
int log2_const< 8 >()
Definition log2_const.h:59
int log2_const< 1024 >()
Definition log2_const.h:94
int log2_const< 4 >()
Definition log2_const.h:54
int log2_const< 512 >()
Definition log2_const.h:89
int log2_const< 64 >()
Definition log2_const.h:74
int log2_const< 2 >()
Definition log2_const.h:49
int log2_const< 32 >()
Definition log2_const.h:69
static int log2_const()
Definition log2_const.h:37
int log2_const< 256 >()
Definition log2_const.h:84
int log2_const< 128 >()
Definition log2_const.h:79
int log2_const< 16 >()
Definition log2_const.h:64
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46