/* * OpenBTS provides an open source alternative to legacy telco protocols and * traditionally complex, proprietary hardware systems. * * Copyright 2008 Free Software Foundation, Inc. * Copyright 2011-2014 Range Networks, Inc. * * This software is distributed under the terms of the GNU Affero General * Public License version 3. See the COPYING and NOTICE files in the main * directory for licensing information. * * This use of this software may be subject to additional restrictions. * See the LEGAL file in the main directory for details. */ #include "BitVector.h" #include "TurboCoder.h" #include #include #include using namespace std; // We must have a gConfig now to include BitVector. #include "Configuration.h" ConfigurationTable gConfig; bool veq(BitVector v1, BitVector v2) { for (unsigned i = 0; i < v1.size(); i++) { if (v1.bit(i) != v2.bit(i)) return false; } return true; } BitVector randomBitVector(int n) { BitVector t(n); for (int i = 0; i < n; i++) t[i] = random()%2; return t; } bool permutationCheck(vector& pv) { BitVector bv(pv.size()); for (unsigned i = 0; i < pv.size(); i++) bv[i] = 0; for (unsigned i = 0; i < pv.size(); i++) { unsigned p = pv[i]; if (p < 0 || p >= pv.size()) return false; if (bv[p]) return false; bv[p] = 1; } return true; } void test2O4() { BitVector v1("0000111100111100101011110000"); cout << v1 << endl; v1.LSB8MSB(); cout << v1 << endl; ViterbiR2O4 vCoder; BitVector v2(v1.size()*2); v1.encode(vCoder,v2); cout << v2 << endl; SoftVector sv2(v2); cout << sv2 << endl; for (unsigned i=0; i