All pastes #75632 Raw Edit

Stuff

public cpp v1 · immutable
#75632 ·published 2006-06-30 11:27 UTC
rendered paste body
#include <stdio.h>int getBit(char c, int index){	char value = c;		if(((value >> index) % 2)) return 1;	return 0;}int getData(char *ptr, int index, int size){	int var = 0;	int bin = 1;		int i = index;	index += size;	while(index > i) 	{		var += getBit(ptr[index/8], index%8) * bin;	index--;	}	return var;}int main(){	char A[] = "ABBB";        printf("%d.\n", getData(&A[0], 0, 7));	return 0;}