11 #include "../firmware.h"
20 void Packet_interleave_32x32(uint8_t *buffer)
23 uint8_t output[128] = { 0 };
27 j = (((i & 0x1f) << 5) + (i >> 5));
29 if((i & 0x07) >= (j & 0x07))
31 output[j>>3] = (uint8_t)(output[j>>3] | ((buffer[i>>3] & (0x80 >> (i & 0x07))) << ((i & 0x07) - (j & 0x07))));
35 output[j>>3] = (uint8_t)(output[j>>3] | ((buffer[i>>3] & (0x80 >> (i & 0x07))) >> ((j & 0x07) - (i & 0x07))));
39 memcpy(buffer, output, 128);
49 void Packet_interleave_64x64(uint8_t *buffer)
52 uint8_t output[512] = { 0 };
56 j = (((i & 0x3f) << 6) + (i >> 6));
58 if((i & 0x07) >= (j & 0x07))
60 output[j>>3] = (uint8_t)(output[j>>3] | ((buffer[i>>3] & (0x80 >> (i & 0x07))) << ((i & 0x07) - (j & 0x07))));
64 output[j>>3] = (uint8_t)(output[j>>3] | ((buffer[i>>3] & (0x80 >> (i & 0x07))) >> ((j & 0x07) - (i & 0x07))));
68 memcpy(buffer, output, 512);