Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Unary coding
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Standard run-length unary codes== All binary data is defined by the ability to represent unary numbers in alternating run-lengths of 1s and 0s. This conforms to the standard definition of unary i.e. N digits of the same number 1 or 0. All run-lengths by definition have at least one digit and thus represent ''strictly positive integers''. {| class="wikitable" ! n !! RL code !! Next code |- | 1 || 1 || 0 |- | 2 || 11 || 00 |- | 3 || 111 || 000 |- | 4 || 1111 || 0000 |- | 5 || 11111 || 00000 |- | 6 || 111111 || 000000 |- | 7 || 1111111 || 0000000 |- | 8 || 11111111 || 00000000 |- | 9 || 111111111 || 000000000 |- | 10 || 1111111111 || 0000000000 |- | colspan="3" | ... |} These codes are guaranteed to end validly on any length of data (when reading arbitrary data) and in the (separate) write cycle allow for the use and transmission of an extra bit (the one used for the first bit) while maintaining overall and per-integer unary code lengths of exactly N.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)