Reusable C++ coding-related code library
  • C++ 98.9%
  • C 1%
Find a file
2018-09-20 08:36:45 +02:00
tests moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00
.gitignore moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00
crc.hh moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00
LICENSE moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00
README.md moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00
xorshift.hh moved crc and xorshift from DSP to CODE repository 2018-09-20 08:36:45 +02:00

This is a work in progress and a long overdue attempt to bring all our not-DSP-related code together and make it reusable for our future projects.

Before using any of this you should enter the tests directory and execute "make". This will check if your compiler is able to create binaries that are able to produce correct results when executed.

What we have included so far:

crc.hh

A Cyclic redundancy check helps ensuring data integrity.

For example, if we need to integrate CRC32 checking for a few bytes, like in the following:

# echo -n 'Hello World!' | rhash -C -
(stdin) 1C291CA3

We can add it to our project as simple as that:

DSP::CRC<uint32_t> crc(0xEDB88320, 0xFFFFFFFF);
for (uint8_t c: std::string("Hello World!")) crc(c);
assert(~crc() == 0x1C291CA3);

xorshift.hh

Sometimes we need a sequence of "random enough" numbers but don't want to store them in an array to get a repeatable sequence. Here a Pseudorandom number generator can help by prodiving a deterministic and thus repeatable sequence of numbers. George Marsaglia discovered a class of simple and fast pseudorandom number generators, which he called Xorshift.