mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
20 lines
No EOL
398 B
C++
20 lines
No EOL
398 B
C++
#include "repack_bits_byte.h"
|
|
|
|
int RepackBitsByte::work(uint8_t *in, int length, uint8_t *out)
|
|
{
|
|
int oo = 0;
|
|
|
|
for (int ii = 0; ii < length; ii++)
|
|
{
|
|
byteToWrite = (byteToWrite << 1) | (((int8_t *)in)[ii] & 1);
|
|
inByteToWrite++;
|
|
|
|
if (inByteToWrite == 8)
|
|
{
|
|
out[oo++] = byteToWrite;
|
|
inByteToWrite = 0;
|
|
}
|
|
}
|
|
|
|
return oo;
|
|
} |