Skip to content

Instantly share code, notes, and snippets.

@b4284
Created October 2, 2015 17:27
Show Gist options
  • Select an option

  • Save b4284/b20bfcf49469be3e1ec7 to your computer and use it in GitHub Desktop.

Select an option

Save b4284/b20bfcf49469be3e1ec7 to your computer and use it in GitHub Desktop.
#include <inttypes.h>
#include <stdio.h>
#include <assert.h>
int main() {
uint8_t F[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
for (uint8_t i = 0; i < 0xFF; ++i) {
for (uint8_t q = 0; q < 8; ++q) {
if ((i & F[q]) > 1) {
assert((i ^ F[q]) == (i & ~F[q]));
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment