/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*  bitplex - Parallel bit stream module.
    Copyright (c) 2007, 2008, Robert D. Cameron.
    Licensed to the public under the Open Software License 3.0.
    Licensed to International Characters, Inc., under the Academic
    Free License 3.0.

    Given a character stream of 8-bit code units, this module
    produces a parallel bit stream representation.


*/
#ifndef BITPLEX_H
#define BITPLEX_H

/*
   A BitBlockBasis is a set of 8 parallel bit blocks that represent 
   a block of 8-bit code units in bit-parallel form. 

   An array of BitBlockBasis blocks is used to represent parallel
   bit stream data.  This means that the individual bit streams are
   are interleaved on a block-by-block basis.   The advantage of this
   representation is that the transposition process can write out the
   bit stream data in a single linear stream.
   
*/

struct BitBlockBasis {
	BitBlock bit[8];
};

static inline BitBlock BitStreamBlock(BitBlockBasis * x8basis, int bit_no, int block_no) {
	return x8basis[block_no].bit[bit_no];
}

/* A BitPlex object holds the parallel bit stream representation of
   a buffer of 8-bit character data. */ 

class Bitplex {
public:
	Bitplex ();
	~Bitplex ();

	BitBlockBasis * x8basis;

	void TransposeToBitStreams(BytePack * pseudo_ASCII_stream, int blocks);
};


#endif