summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/misc.cc
blob: 8207387cb9388913e4fd93ba9b4c14a1e6bb76d7 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -*- c++ -*- */
/*
 * Copyright 2005,2013 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "misc.h"

namespace gr {

unsigned int rounduppow2(unsigned int n)
{
    int i;
    for (i = 0; ((n - 1) >> i) != 0; i++)
        ;
    return 1 << i;
}

// ----------------------------------------------------------------

void zero_vector(std::vector<float>& v)
{
    for (unsigned int i = 0; i < v.size(); i++)
        v[i] = 0;
}

void zero_vector(std::vector<double>& v)
{
    for (unsigned int i = 0; i < v.size(); i++)
        v[i] = 0;
}

void zero_vector(std::vector<int>& v)
{
    for (unsigned int i = 0; i < v.size(); i++)
        v[i] = 0;
}

void zero_vector(std::vector<gr_complex>& v)
{
    for (unsigned int i = 0; i < v.size(); i++)
        v[i] = 0;
}

} /* namespace gr */