aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-05-27 16:29:38 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-05-27 16:29:38 +0200
commit4fe6a33685ce9cc0be44319fca5ce30e05bfb090 (patch)
treec11d2171eeb0a11fdeec87770baa47fbeb6452b5 /src
parentc3f5387d9d8d3fd36e8bcf562c1ad4cc99e38a91 (diff)
downloaddabmod-4fe6a33685ce9cc0be44319fca5ce30e05bfb090.tar.gz
dabmod-4fe6a33685ce9cc0be44319fca5ce30e05bfb090.tar.bz2
dabmod-4fe6a33685ce9cc0be44319fca5ce30e05bfb090.zip
Replace some unsigned types
Diffstat (limited to 'src')
-rw-r--r--src/BlockPartitioner.cpp4
-rw-r--r--src/ConvEncoder.cpp30
-rw-r--r--src/DifferentialModulator.cpp4
-rw-r--r--src/Eti.cpp4
-rw-r--r--src/FicSource.cpp2
-rw-r--r--src/FrameMultiplexer.cpp6
-rw-r--r--src/InputReader.h4
-rw-r--r--src/InputZeroMQReader.cpp2
-rw-r--r--src/PhaseReference.cpp4
-rw-r--r--src/QpskSymbolMapper.cpp8
-rw-r--r--src/Resampler.cpp5
11 files changed, 37 insertions, 36 deletions
diff --git a/src/BlockPartitioner.cpp b/src/BlockPartitioner.cpp
index 6d216c1..86d9cca 100644
--- a/src/BlockPartitioner.cpp
+++ b/src/BlockPartitioner.cpp
@@ -91,11 +91,11 @@ int BlockPartitioner::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
#ifdef DEBUG
fprintf(stderr, "BlockPartitioner::process(dataIn:");
- for (unsigned i = 0; i < dataIn.size(); ++i) {
+ for (size_t i = 0; i < dataIn.size(); ++i) {
fprintf(stderr, " %p", dataIn[i]);
}
fprintf(stderr, ", sizeIn:");
- for (unsigned i = 0; i < dataIn.size(); ++i) {
+ for (size_t i = 0; i < dataIn.size(); ++i) {
fprintf(stderr, " %zu", dataIn[i]->getLength());
}
fprintf(stderr, ", dataOut: %p, sizeOut: %zu)\n", dataOut, dataOut->getLength());
diff --git a/src/ConvEncoder.cpp b/src/ConvEncoder.cpp
index 3245d30..f3fc0f9 100644
--- a/src/ConvEncoder.cpp
+++ b/src/ConvEncoder.cpp
@@ -27,7 +27,7 @@
#include <stdexcept>
-const static unsigned char PARITY[] = {
+const static uint8_t PARITY[] = {
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
@@ -73,8 +73,8 @@ int ConvEncoder::process(Buffer* const dataIn, Buffer* dataOut)
size_t out_block_size = (d_framesize * 4) + 3;
size_t in_offset = 0;
size_t out_offset = 0;
- unsigned short memory = 0;
- unsigned char data;
+ uint16_t memory = 0;
+ uint8_t data;
if (dataIn->getLength() != in_block_size) {
PDEBUG("%zu != %zu != 0\n", dataIn->getLength(), in_block_size);
@@ -82,8 +82,8 @@ int ConvEncoder::process(Buffer* const dataIn, Buffer* dataOut)
"ConvEncoder::process input size not valid!\n");
}
dataOut->setLength(out_block_size);
- const unsigned char* in = reinterpret_cast<const unsigned char*>(dataIn->getData());
- unsigned char* out = reinterpret_cast<unsigned char*>(dataOut->getData());
+ const uint8_t* in = reinterpret_cast<const uint8_t*>(dataIn->getData());
+ uint8_t* out = reinterpret_cast<uint8_t*>(dataOut->getData());
// While there is enought input and ouput items
while (dataIn->getLength() - in_offset >= in_block_size &&
@@ -100,11 +100,11 @@ int ConvEncoder::process(Buffer* const dataIn, Buffer* dataOut)
memory |= (data >> 7) << 6;
data <<= 1;
//PDEBUG("Memory: 0x%x\n", memory);
- unsigned char poly[4] = {
- (unsigned char)(memory & 0x5b),
- (unsigned char)(memory & 0x79),
- (unsigned char)(memory & 0x65),
- (unsigned char)(memory & 0x5b)
+ uint8_t poly[4] = {
+ (uint8_t)(memory & 0x5b),
+ (uint8_t)(memory & 0x79),
+ (uint8_t)(memory & 0x65),
+ (uint8_t)(memory & 0x5b)
};
//PDEBUG("Polys: 0x%x, 0x%x, 0x%x, 0x%x\n", poly[0], poly[1], poly[2], poly[3]);
// For each poly
@@ -125,11 +125,11 @@ int ConvEncoder::process(Buffer* const dataIn, Buffer* dataOut)
for (unsigned j = 0; j < 2; ++j) {
memory >>= 1;
//PDEBUG("Memory: 0x%x\n", memory);
- unsigned char poly[4] = {
- (unsigned char)(memory & 0x5b),
- (unsigned char)(memory & 0x79),
- (unsigned char)(memory & 0x65),
- (unsigned char)(memory & 0x5b)
+ uint8_t poly[4] = {
+ (uint8_t)(memory & 0x5b),
+ (uint8_t)(memory & 0x79),
+ (uint8_t)(memory & 0x65),
+ (uint8_t)(memory & 0x5b)
};
//PDEBUG("Polys: 0x%x, 0x%x, 0x%x, 0x%x\n", poly[0], poly[1], poly[2], poly[3]);
// For each poly
diff --git a/src/DifferentialModulator.cpp b/src/DifferentialModulator.cpp
index ca499ec..11ae415 100644
--- a/src/DifferentialModulator.cpp
+++ b/src/DifferentialModulator.cpp
@@ -52,11 +52,11 @@ int DifferentialModulator::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
{
#ifdef DEBUG
fprintf(stderr, "DifferentialModulator::process (dataIn:");
- for (unsigned i = 0; i < dataIn.size(); ++i) {
+ for (size_t i = 0; i < dataIn.size(); ++i) {
fprintf(stderr, " %p", dataIn[i]);
}
fprintf(stderr, ", sizeIn: ");
- for (unsigned i = 0; i < dataIn.size(); ++i) {
+ for (size_t i = 0; i < dataIn.size(); ++i) {
fprintf(stderr, " %zu", dataIn[i]->getLength());
}
fprintf(stderr, ", dataOut: %p, sizeOut: %zu)\n", dataOut, dataOut->getLength());
diff --git a/src/Eti.cpp b/src/Eti.cpp
index edd5aae..1bad706 100644
--- a/src/Eti.cpp
+++ b/src/Eti.cpp
@@ -31,9 +31,9 @@
//definitions des structures des champs du ETI(NI, G703)
-unsigned short eti_FC::getFrameLength()
+uint16_t eti_FC::getFrameLength()
{
- return (unsigned short)((FL_high << 8) | FL_low);
+ return (uint16_t)((FL_high << 8) | FL_low);
}
diff --git a/src/FicSource.cpp b/src/FicSource.cpp
index 6a18ca4..b106955 100644
--- a/src/FicSource.cpp
+++ b/src/FicSource.cpp
@@ -66,7 +66,7 @@ FicSource::FicSource(eti_FC &fc) :
FicSource::~FicSource()
{
PDEBUG("FicSource::~FicSource()\n");
- for (unsigned i = 0; i < d_puncturing_rules.size(); ++i) {
+ for (size_t i = 0; i < d_puncturing_rules.size(); ++i) {
// PDEBUG(" Deleting rules @ %p\n", d_puncturing_rules[i]);
delete d_puncturing_rules[i];
}
diff --git a/src/FrameMultiplexer.cpp b/src/FrameMultiplexer.cpp
index ffae2ca..80d347e 100644
--- a/src/FrameMultiplexer.cpp
+++ b/src/FrameMultiplexer.cpp
@@ -60,17 +60,17 @@ int FrameMultiplexer::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
#ifdef DEBUG
fprintf(stderr, "FrameMultiplexer::process(dataIn:");
- for (unsigned i = 0; i < dataIn.size(); ++i) {
+ for (size_t i = 0; i < dataIn.size(); ++i) {
fprintf(stderr, " %p", dataIn[i]);
}
fprintf(stderr, ", sizeIn:");
- for (unsigned i = 0; i < dataIn.size(); ++i) {
+ for (size_t i = 0; i < dataIn.size(); ++i) {
fprintf(stderr, " %zu", dataIn[i]->getLength());
}
fprintf(stderr, ", dataOut: %p, sizeOut: %zu)\n", dataOut, dataOut->getLength());
#endif
- unsigned char* out = reinterpret_cast<unsigned char*>(dataOut->getData());
+ uint8_t* out = reinterpret_cast<uint8_t*>(dataOut->getData());
std::vector<Buffer*>::const_iterator in = dataIn.begin();
// Write PRBS
diff --git a/src/InputReader.h b/src/InputReader.h
index d2b5d8c..daacc9e 100644
--- a/src/InputReader.h
+++ b/src/InputReader.h
@@ -149,7 +149,7 @@ struct InputZeroMQThreadData
{
ThreadsafeQueue<std::shared_ptr<std::vector<uint8_t> > > *in_messages;
std::string uri;
- unsigned max_queued_frames;
+ size_t max_queued_frames;
};
class InputZeroMQWorker
@@ -194,7 +194,7 @@ class InputZeroMQReader : public InputReader
worker_.Stop();
}
- int Open(const std::string& uri, unsigned max_queued_frames);
+ int Open(const std::string& uri, size_t max_queued_frames);
int GetNextFrame(void* buffer);
diff --git a/src/InputZeroMQReader.cpp b/src/InputZeroMQReader.cpp
index a640812..69e1ffd 100644
--- a/src/InputZeroMQReader.cpp
+++ b/src/InputZeroMQReader.cpp
@@ -62,7 +62,7 @@ struct zmq_dab_message_t
uint8_t buf[NUM_FRAMES_PER_ZMQ_MESSAGE*6144];
};
-int InputZeroMQReader::Open(const std::string& uri, unsigned max_queued_frames)
+int InputZeroMQReader::Open(const std::string& uri, size_t max_queued_frames)
{
// The URL might start with zmq+tcp://
if (uri.substr(0, 4) == "zmq+") {
diff --git a/src/PhaseReference.cpp b/src/PhaseReference.cpp
index 840917f..691226b 100644
--- a/src/PhaseReference.cpp
+++ b/src/PhaseReference.cpp
@@ -32,7 +32,7 @@ typedef std::complex<float> complexf;
/* ETSI EN 300 401 Table 43 (Clause 14.3.2)
* Contains h_{i,k} values
*/
-const unsigned char PhaseReference::d_h[4][32] = {
+const uint8_t PhaseReference::d_h[4][32] = {
/* h0 */ { 0, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 2, 2, 1, 1,
0, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 2, 2, 1, 1 },
/* h1 */ { 0, 3, 2, 3, 0, 1, 3, 0, 2, 1, 2, 3, 2, 3, 3, 0,
@@ -96,7 +96,7 @@ PhaseReference::~PhaseReference()
}
-complexf convert(unsigned char data) {
+complexf convert(uint8_t data) {
const complexf value[] = {
complexf(1, 0),
complexf(0, 1),
diff --git a/src/QpskSymbolMapper.cpp b/src/QpskSymbolMapper.cpp
index 05d847c..b82cc61 100644
--- a/src/QpskSymbolMapper.cpp
+++ b/src/QpskSymbolMapper.cpp
@@ -58,7 +58,7 @@ int QpskSymbolMapper::process(Buffer* const dataIn, Buffer* dataOut)
dataOut->setLength(dataIn->getLength() * 4 * 2 * sizeof(float)); // 4 output complex symbols per input byte
#ifdef __SSE__
- const unsigned char* in = reinterpret_cast<const unsigned char*>(dataIn->getData());
+ const uint8_t* in = reinterpret_cast<const uint8_t*>(dataIn->getData());
__m128* out = reinterpret_cast<__m128*>(dataOut->getData());
if (dataIn->getLength() % (d_carriers / 4) != 0) {
@@ -88,7 +88,7 @@ int QpskSymbolMapper::process(Buffer* const dataIn, Buffer* dataOut)
};
size_t inOffset = 0;
size_t outOffset = 0;
- unsigned char tmp = 0;
+ uint8_t tmp = 0;
for (size_t i = 0; i < dataIn->getLength(); i += d_carriers / 4) {
for (size_t j = 0; j < d_carriers / 8; ++j) {
tmp = (in[inOffset] & 0xc0) >> 4;
@@ -109,7 +109,7 @@ int QpskSymbolMapper::process(Buffer* const dataIn, Buffer* dataOut)
inOffset += d_carriers / 8;
}
#else // !__SSE__
- const unsigned char* in = reinterpret_cast<const unsigned char*>(dataIn->getData());
+ const uint8_t* in = reinterpret_cast<const uint8_t*>(dataIn->getData());
float* out = reinterpret_cast<float*>(dataOut->getData());
if (dataIn->getLength() % (d_carriers / 4) != 0) {
throw std::runtime_error(
@@ -140,7 +140,7 @@ int QpskSymbolMapper::process(Buffer* const dataIn, Buffer* dataOut)
};
size_t inOffset = 0;
size_t outOffset = 0;
- unsigned char tmp;
+ uint8_t tmp;
for (size_t i = 0; i < dataIn->getLength(); i += d_carriers / 4) {
for (size_t j = 0; j < d_carriers / 8; ++j) {
tmp = (in[inOffset] & 0xc0) >> 4;
diff --git a/src/Resampler.cpp b/src/Resampler.cpp
index 4ad6638..f09a58d 100644
--- a/src/Resampler.cpp
+++ b/src/Resampler.cpp
@@ -38,7 +38,8 @@
# define FFT_IMAG(x) x[1]
#endif
-unsigned gcd(unsigned a, unsigned b)
+template<class T>
+T gcd(T a, T b)
{
if (b == 0) {
return a;
@@ -106,7 +107,7 @@ Resampler::Resampler(size_t inputRate, size_t outputRate, size_t resolution) :
M = inputRate / divisor;
PDEBUG(" gcd: %zu, L: %zu, M: %zu\n", divisor, L, M);
{
- unsigned factor = resolution * 2 / M;
+ size_t factor = resolution * 2 / M;
if (factor & 1) {
++factor;
}