Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component gray2bin "convert a gray-code input to binary";
- pin in unsigned in "gray code in";
- pin out unsigned out "gray code out";
- license "GPL";
- author "andy pugh";
- function _;
- ;;
- u32 mask;
- u32 num = in;
- for(mask = num >> 1 ; mask != 0 ; mask = mask >> 1){
- num ^= mask;
- }
- out = num;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement