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

    return 0;
