Talk:Gray code: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎D encoding: Interesting task)
Line 4: Line 4:
:It has been stated in wikipedia :) [[User:Dingowolf|dingowolf]] 11:17, 18 March 2011 (UTC)
:It has been stated in wikipedia :) [[User:Dingowolf|dingowolf]] 11:17, 18 March 2011 (UTC)
::Wow. Reading is hard. I'm definitely changing the Java version. --[[User:Mwn3d|Mwn3d]] 13:04, 18 March 2011 (UTC)
::Wow. Reading is hard. I'm definitely changing the Java version. --[[User:Mwn3d|Mwn3d]] 13:04, 18 March 2011 (UTC)
:::The only tricky bit in decoding is that you need the previously decoded bit to decode the next one. That makes everything just that ''little'' bit messier (as evidenced by the many strategies shown for decoding!) though it does mean that everything admits a rather nice decode loop if you're cunning enough. (Decoding tables? O RLY? SRSLY?) –[[User:Dkf|Donal Fellows]] 14:47, 18 March 2011 (UTC)


== Decoding a bitstream ==
== Decoding a bitstream ==

Revision as of 14:47, 18 March 2011

D encoding

Am I reading the D encoding right? Gray code is just the number xor'd with its right shifted value? If so, my mind is blown. --Mwn3d 04:41, 18 March 2011 (UTC)

It has been stated in wikipedia :) dingowolf 11:17, 18 March 2011 (UTC)
Wow. Reading is hard. I'm definitely changing the Java version. --Mwn3d 13:04, 18 March 2011 (UTC)
The only tricky bit in decoding is that you need the previously decoded bit to decode the next one. That makes everything just that little bit messier (as evidenced by the many strategies shown for decoding!) though it does mean that everything admits a rather nice decode loop if you're cunning enough. (Decoding tables? O RLY? SRSLY?) –Donal Fellows 14:47, 18 March 2011 (UTC)

Decoding a bitstream

Decoding individual symbols looks trivial; you could do it with a lookup table. What would decoding a Gray code bitstream look like? Finding the the beginning of each symbol might be a tad trickier. --Michael Mol 13:13, 18 March 2011 (UTC)