summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/uchar_array_to_float.cc
blob: beb1c61d0f044a275c9f601fc5df2fd4685d0f1d (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
/* -*- c++ -*- */
/*
 * Copyright 2005,2012 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#include "uchar_array_to_float.h"

void uchar_array_to_float(const unsigned char* in, float* out, int nsamples)
{
    while (nsamples >= 4) {
        out[0] = in[0];
        out[1] = in[1];
        out[2] = in[2];
        out[3] = in[3];
        out += 4;
        in += 4;
        nsamples -= 4;
    }

    while (nsamples-- > 0)
        *out++ = *in++;
}