component gray2bin "convert a gray-code input to binary";
description """Converts a gray-coded number into the corresponding binary value""";
pin in unsigned in "gray code in";
pin out unsigned out "binary code out";
license "GPL";
author "andy pugh";
function _ nofp;
;;
hal_u32_t mask;
    out = in;
    for(mask = in >> 1 ; mask != 0 ; mask = mask >> 1)
        {
        out ^= mask;
        }

    return 0;
