All pastes #53047 Raw Edit

Untitled

public text v1 · immutable
#53047 ·published 2006-05-03 00:33 UTC
rendered paste body
#define SET_BIT(x,y) coordinate[(x) / 8][y] |= (0x80 >> ((x) % 8))
#define CLEAR_BIT(x,y) coordinate[(x) / 8][y] &= (0x0 >> ((x) % 8))
#define TEST_BIT(x,y) coordinate[(x) / 8][y] |= (0x80 >> ((x) % 8))

#include <stdio.h>

char coordinate[X_SIZE / 8][Y_SIZE];

void print_graph(void){
int x = 0;
int y = 0;
unsigned int bit;

for (y = 0; y < Y_SIZE; y++){
	for (x = 0; x < X_SIZE / 8; x++){
		for (bit = 0x80; bit > 0; bit = bit >> 1){
			if ((bit & coordinate[x][y]) == 0) 
				printf(" . ");
			else
				printf(" X ");
			}	
		}
	printf("New line\n");
	}
}