blob: 063138f33a43fdbf3be6168e83629901ac9355dc [file] [log] [blame]
dburgess82c46ff2011-10-07 02:40:51 +00001/*
2* Copyright 2008 Free Software Foundation, Inc.
3*
4*
5* This software is distributed under the terms of the GNU Affero Public License.
6* See the COPYING file in the main directory for details.
7*
8* This use of this software may be subject to additional restrictions.
9* See the LEGAL file in the main directory for details.
10
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU Affero General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU Affero General Public License for more details.
20
21 You should have received a copy of the GNU Affero General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23
24*/
25
26
27
28
29#include "BitVector.h"
30#include <iostream>
31#include <cstdlib>
32
33using namespace std;
34
35
36int main(int argc, char *argv[])
37{
dburgess82c46ff2011-10-07 02:40:51 +000038 BitVector v5("000011110000");
39 int r1 = v5.peekField(0,8);
40 int r2 = v5.peekField(4,4);
41 int r3 = v5.peekField(4,8);
42 cout << r1 << ' ' << r2 << ' ' << r3 << endl;
43 cout << v5 << endl;
44 v5.fillField(0,0xa,4);
45 int r4 = v5.peekField(0,8);
46 cout << v5 << endl;
47 cout << r4 << endl;
48
49 v5.reverse8();
50 cout << v5 << endl;
51
dburgess82c46ff2011-10-07 02:40:51 +000052
53 unsigned char ts[9] = "abcdefgh";
54 BitVector tp(70);
55 cout << "ts=" << ts << endl;
56 tp.unpack(ts);
57 cout << "tp=" << tp << endl;
58 tp.pack(ts);
59 cout << "ts=" << ts << endl;
60}