#include <stdio.h>
#include <stdint.h>

uint32_t hexChars[8] = {0};

uint32_t isHex(uint8_t ch)
{
	return hexChars[ch >> 5] & (1 << (ch & 0x1F));
}

void setBits(char *s)
{
	while (*s)
	{
		hexChars[(*s) >> 5] |= (1 << ((*s) & 0x1F));
		s++;
	}
}

int main(void) {
	int i;
	uint8_t test[] = "A test for hex characters 0123456789ABCDEFabcdef";
	setBits("0123456789ABCDEFabcdef");
	
	for (i = 0; i < 8; ++i)
		printf("%08x, ", hexChars[i]);
	
	for (i = 0; i < strlen(test); ++i)
	{
		if (isHex(test[i]))
			printf("%c is a hex character\n", test[i]);
		else
			printf("%c is NOT a hex character\n", test[i]);
	}
	return 0;
}
