Gray Code
- From: "bwaichu@xxxxxxxxx" <bwaichu@xxxxxxxxx>
- Date: 26 Sep 2006 17:10:25 -0700
I am working my way through CRC32, and one implementation of CRC32 uses
Gray coding or reflected coding. Actually, upon examination, it looks
like openSSH uses Gray coding in it's CRC32 implementation.
Where I am stuck is with the binary math and the difference between 1,
2, and 4 bit reflections.
If I have the following , what would be it's 1, 2, and 4 bit
reflections?
1010-1111-0011
My understandings is that I XOR the right shifted value by the number
of bits:
1010-1111-0011 (n)
0101-0111-1001 (n >> 1)
----------------------
1111-1000-1010
So the above in C is:
n ^ ( n >> 1)
Is the above correct?
Also, what is meant by 1, 2, and 4 bit reflections? Am I shifting by
that many bits? I am not quite sure.
Thanks!
.
- Follow-Ups:
- Re: Gray Code
- From: eKo1
- Re: Gray Code
- Prev by Date: Please add your name
- Next by Date: Re: On the complexity of determining whether n numbers are distinct
- Previous by thread: Please add your name
- Next by thread: Re: Gray Code
- Index(es):
Relevant Pages
|