1 #ifndef LEANSDR_SOFTWORD_H 2 #define LEANSDR_SOFTWORD_H 25 return p & (1 << (7 - b));
29 hard_sb mask = 1 << (7 - b);
30 *p = ((*p) & ~mask) | (v << (7 - b));
42 inline bool softwords_xor(
const hard_sb p1[],
const hard_sb p2[],
int b)
44 return (p1[b / 8] ^ p2[b / 8]) & (1 << (7 - (b & 7)));
52 p[b / 8] |= 1 << (7 - (b & 7));
56 hard_sb mask = 1 << (7 - b);
57 p = (p & ~mask) | (hard_sb)v << (7 - b);
65 p[b / 8] ^= 1 << (7 - (b & 7));
81 return (127.0 + l) / 254;
85 int r = -127 + 254 * p;
95 return llr(px * (1 - py) + (1 - px) * py);
113 memset(p->
bits, 0,
sizeof(p->
bits));
125 ((b.
bits[1] & 128) >> 1) |
126 ((b.
bits[2] & 128) >> 2) |
127 ((b.
bits[3] & 128) >> 3) |
128 ((b.
bits[4] & 128) >> 4) |
129 ((b.
bits[5] & 128) >> 5) |
130 ((b.
bits[6] & 128) >> 6) |
131 ((b.
bits[7] & 128) >> 7));
142 memset(p, -127,
sizeof(*p));
146 p[b / 8].
bits[b & 7] = 127;
163 for (
uint8_t *q = storage; nbytes--; ++p, ++q)
170 template <
typename SOFTBIT,
typename SOFTBYTE>
175 template <
typename SOFTBIT,
typename SOFTBYTE>
180 template <
typename SOFTBIT,
typename SOFTBYTE>
188 #endif // LEANSDR_SOFTWORD_H uint8_t * softbytes_harden(hard_sb p[], int nbytes, uint8_t storage[])
void softword_write(hard_sb &p, int b, bool v)
bool softwords_xor(const hard_sb p1[], const hard_sb p2[], int b)
bool softbit_harden(bool b)
Fixed< IntType, IntBits > abs(Fixed< IntType, IntBits > const &x)
void softwords_flip(hard_sb p[], int b)
void softbit_clear(bool *p)
uint8_t softbyte_harden(const hard_sb &b)
bool softword_weight(const bool &l)
llr_t llr_xor(llr_t lx, llr_t ly)
void softword_zero(hard_sb *p)
void softword_set(hard_sb *p, int b, bool v)
llr_t softwords_get(const llr_sb p[], int b)
bool softbit_xor(bool x, bool y)
void softwords_set(hard_sb p[], int b)
void softbit_set(bool *p, bool v)
bool softword_get(const hard_sb &p, int b)
void softword_clear(hard_sb *p)
void softwords_write(hard_sb p[], int b, bool v)
SOFTBIT softwords_weight(const SOFTBYTE p[], int b)