MFFM Bit Stream



Information
Download
More about this author


_____________BEGIN bitStreamWriteExample.C_____________   
#include "bitStreamWrite.H"
BitStreamWrite bsb("test.bin",4);

for (int i=1;i<15;i++){
  bsb->resetBitCnt(i);
  bsb->put(i);
}
for (int i=15;i>=1;i--){
  bsb->resetBitCnt(i);
  bsb->put(i);
}
___________END bitStreamWriteExample.C_____________

$ hexdump test.bin
0000000 151d 80e3 4090 0581 4030 7003 1e00 0e00
0000010 0340 8060 2805 0090 60e1 9a14         


_____________BEGIN bitStreamReadExample.C_____________
#include "bitStreamRead.H"
BitStreamRead bsb("test.bin",4);

for (int i=1;i<15;i++){
  bsb->resetBitCnt(i);
  printf("0x%x\n",bsb->get());
}
for (int i=15;i>=1;i--){
  bsb->resetBitCnt(i);
  printf("0x%x\n",bsb->get());
}
___________END bitStreamWriteExample.C_____________
$ ./bitStreamWriteExample
0x1
0x2
0x3
0x4
0x5
0x6
0x7
0x8
0x9
0xa
0xb
0xc
0xd
0xe
0xf
0xe
0xd
0xc
0xb
0xa
0x9
0x8
0x7
0x6
0x5
0x4
0x3
BitStreamRead::read : couldn't read data from file.
0x2
0x1


SourceForge.net Logo