diff options
author | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2017-03-24 22:56:08 -0700 |
---|---|---|
committer | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2017-05-30 20:12:58 +0000 |
commit | 15f9d95f5f44db3ff92ee157c37e4915bffb9129 (patch) | |
tree | 7c0c795311f7d1f54022ba1f0acdb1a01f6a9043 /CommonLibs | |
parent | 73dbccda78d2eb77691f62202a4e3cbeabf93410 (diff) |
BitVector: Remove Generator class.
It is not used in osmo-trx, because we're not doing FEC or CRC checks.
Change-Id: I1509e785c1187ebdafe5b2518bd298fbbd1cd036
Diffstat (limited to 'CommonLibs')
-rw-r--r-- | CommonLibs/BitVector.cpp | 19 | ||||
-rw-r--r-- | CommonLibs/BitVector.h | 67 |
2 files changed, 0 insertions, 86 deletions
diff --git a/CommonLibs/BitVector.cpp b/CommonLibs/BitVector.cpp index 3b556b9..cf408cd 100644 --- a/CommonLibs/BitVector.cpp +++ b/CommonLibs/BitVector.cpp @@ -200,25 +200,6 @@ void BitVector::LSB8MSB() -uint64_t BitVector::syndrome(Generator& gen) const -{ - gen.clear(); - const char *dp = mStart; - while (dp<mEnd) gen.syndromeShift(*dp++); - return gen.state(); -} - - -uint64_t BitVector::parity(Generator& gen) const -{ - gen.clear(); - const char *dp = mStart; - while (dp<mEnd) gen.encoderShift(*dp++); - return gen.state(); -} - - - unsigned BitVector::sum() const { unsigned sum = 0; diff --git a/CommonLibs/BitVector.h b/CommonLibs/BitVector.h index d2acb5f..559dd99 100644 --- a/CommonLibs/BitVector.h +++ b/CommonLibs/BitVector.h @@ -30,65 +30,6 @@ #include <stdint.h> -class BitVector; -class SoftVector; - - - -/** Shift-register (LFSR) generator. */ -class Generator { - - private: - - uint64_t mCoeff; ///< polynomial coefficients. LSB is zero exponent. - uint64_t mState; ///< shift register state. LSB is most recent. - uint64_t mMask; ///< mask for reading state - unsigned mLen; ///< number of bits used in shift register - unsigned mLen_1; ///< mLen - 1 - - public: - - Generator(uint64_t wCoeff, unsigned wLen) - :mCoeff(wCoeff),mState(0), - mMask((1ULL<<wLen)-1), - mLen(wLen),mLen_1(wLen-1) - { assert(wLen<64); } - - void clear() { mState=0; } - - /**@name Accessors */ - //@{ - uint64_t state() const { return mState & mMask; } - unsigned size() const { return mLen; } - //@} - - /** - Calculate one bit of a syndrome. - This is in the .h for inlining. - */ - void syndromeShift(unsigned inBit) - { - const unsigned fb = (mState>>(mLen_1)) & 0x01; - mState = (mState<<1) ^ (inBit & 0x01); - if (fb) mState ^= mCoeff; - } - - /** - Update the generator state by one cycle. - This is in the .h for inlining. - */ - void encoderShift(unsigned inBit) - { - const unsigned fb = ((mState>>(mLen_1)) ^ inBit) & 0x01; - mState <<= 1; - if (fb) mState ^= mCoeff; - } - - -}; - - - class BitVector : public Vector<char> { @@ -146,14 +87,6 @@ class BitVector : public Vector<char> { void zero() { fill(0); } - /**@name FEC operations. */ - //@{ - /** Calculate the syndrome of the vector with the given Generator. */ - uint64_t syndrome(Generator& gen) const; - /** Calculate the parity word for the vector with the given Generator. */ - uint64_t parity(Generator& gen) const; - //@} - /** Invert 0<->1. */ void invert(); |