/*************************************************************************** interleaver.cpp - description ------------------- begin : Sam Mär 1 2003 copyright : (C) 2003 by Volker Schroer email : dl1ksv@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "interleaver.h" Interleaver::Interleaver() { pipe0 = 0; pipe1 = 0; pipe2 = 0; pipe3 = 0; } Interleaver::~Interleaver() { } int Interleaver::interleave(int bits) { pipe0 = (pipe0 << 1) | ((bits >> 0) & 1); pipe1 = (pipe1 << 1) | ((bits >> 1) & 1); pipe2 = (pipe2 << 1) | ((bits >> 2) & 1); pipe3 = (pipe3 << 1) | ((bits >> 3) & 1); /** bits = (pipe0 >> 3) & 1; bits |= (pipe1 >> 1) & 2; bits |= (pipe2 << 1) & 4; bits |= (pipe3 << 3) & 8; **/ bits = pipe0 & 1; bits |= pipe1 & 2; bits |= pipe2 & 4; bits |= pipe3 & 8; return bits; }