/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to parse/parabix.20090922/src/bitplex.h

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-23 17:13:04 UTC
  • Revision ID: csa@dside.dyndns.org-20090923171304-osvtr4zqb29h11kd
Intel, Tango, Phobos, and RapidXML parsers; Memory benchmark scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  bitplex - Parallel bit stream module.
 
2
    Copyright (c) 2007, 2008, Robert D. Cameron.
 
3
    Licensed to the public under the Open Software License 3.0.
 
4
    Licensed to International Characters, Inc., under the Academic
 
5
    Free License 3.0.
 
6
 
 
7
    Given a character stream of 8-bit code units, this module
 
8
    produces a parallel bit stream representation.
 
9
 
 
10
 
 
11
*/
 
12
#ifndef BITPLEX_H
 
13
#define BITPLEX_H
 
14
 
 
15
/*
 
16
   A BitBlockBasis is a set of 8 parallel bit blocks that represent 
 
17
   a block of 8-bit code units in bit-parallel form. 
 
18
 
 
19
   An array of BitBlockBasis blocks is used to represent parallel
 
20
   bit stream data.  This means that the individual bit streams are
 
21
   are interleaved on a block-by-block basis.   The advantage of this
 
22
   representation is that the transposition process can write out the
 
23
   bit stream data in a single linear stream.
 
24
   
 
25
*/
 
26
 
 
27
struct BitBlockBasis {
 
28
        BitBlock bit[8];
 
29
};
 
30
 
 
31
static inline BitBlock BitStreamBlock(BitBlockBasis * x8basis, int bit_no, int block_no) {
 
32
        return x8basis[block_no].bit[bit_no];
 
33
}
 
34
 
 
35
/* A BitPlex object holds the parallel bit stream representation of
 
36
   a buffer of 8-bit character data. */ 
 
37
 
 
38
class Bitplex {
 
39
public:
 
40
        Bitplex ();
 
41
        ~Bitplex ();
 
42
 
 
43
        BitBlockBasis * x8basis;
 
44
 
 
45
        void TransposeToBitStreams(BytePack * pseudo_ASCII_stream, int blocks);
 
46
};
 
47
 
 
48
 
 
49
#endif