void gcd(short unsigned int a, short unsigned int b, short unsigned int *outp) { short unsigned int result = 0; short unsigned int x, y; x = a; y = b; if ((x!=0) && (y!=0)) { while (x != y) { if (x >= y) { x = x - y; } else { y = y - x; } } result = x; } else { result = 0; } *outp = result; }