Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -1,15 +0,0 @@
|
|||
defmodule Gray_code do
|
||||
use Bitwise
|
||||
def encode(n), do: bxor(n, bsr(n,1))
|
||||
|
||||
def decode(g), do: decode(g,0)
|
||||
|
||||
def decode(0,n), do: n
|
||||
def decode(g,n), do: decode(bsr(g,1), bxor(g,n))
|
||||
end
|
||||
|
||||
Enum.each(0..31, fn(n) ->
|
||||
g = Gray_code.encode(n)
|
||||
d = Gray_code.decode(g)
|
||||
:io.fwrite("~2B : ~5.2.0B : ~5.2.0B : ~5.2.0B : ~2B~n", [n, n, g, d, d])
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue