Skip to content

Instantly share code, notes, and snippets.

@nullableVoidPtr
Last active August 4, 2019 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nullableVoidPtr/e6840696c3123ea5c192a1f33d86435e to your computer and use it in GitHub Desktop.
Save nullableVoidPtr/e6840696c3123ea5c192a1f33d86435e to your computer and use it in GitHub Desktop.
#include <stdio.h>
unsigned char gcd256(unsigned char a) {
for (int i = 0; i < 8; i++) if ((a >> i) & 1) return 1 << i;
}
int main() {
for (int i = 0; i < 256; i++) printf("%d\n", gcd256(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment