Beispiel #1
0
void f(void) {
	int b1 = B1();
	if (b1) {
		int b2 = B2();
		if (b2) {
			B3();
		} else {
			B4();
		}
	}
	B5();
	while (B6()) {
		B12();
		int b14;
		do {
			B13();
			b14 = B14();
		} while(b14);
		B15();
	}
	int b7 = B7();
	if (b7 || B8()) {
		B9();
	}
	B10();
	B11();
}
Beispiel #2
0
 *
 *  Created on: 21.07.2014
 *      Author: kovalevfm
 */

#include "bitmap.h"
#include <iostream>
#include <cmath>
#include <cassert>

static const unsigned char BitsSetTable256[256] =
{
#   define B2(n) n,     n+1,     n+1,     n+2
#   define B4(n) B2(n), B2(n+1), B2(n+1), B2(n+2)
#   define B6(n) B4(n), B4(n+1), B4(n+1), B4(n+2)
    B6(0), B6(1), B6(1), B6(2)
};

size_t count_bits(uint32_t word){
    unsigned char * p = (unsigned char *) &word;
    return BitsSetTable256[p[0]] +
           BitsSetTable256[p[1]] +
           BitsSetTable256[p[2]] +
           BitsSetTable256[p[3]];
}

const size_t BitMap::block_size = sizeof(uint32_t) * 8;

std::ostream& operator<<(std::ostream &os, const BitMap &bitmap){
    for (size_t pos = 0; pos < bitmap.size(); ++pos) {
        os << (bitmap.get(pos) ? 1 : 0);