[Ronja] golay code

milos chmel xchmelmilos at gmail.com
Sat Feb 2 18:34:26 GMT 2008


hi,
i just realized that,
y=-1; /* 0xffff */
for(i=0;i<5;++i)
   y^=1<<(dodekahedron[i]-1);

equals to

y=0;
for(i=0;i<5;++i)
   y|=1<<(dodekahedron[][i]-1); /* shift 1 to positions */
y=~y;

....
0xff==(unsigned)-1 ^ 12 clears place where 12 has 1' bits
dodekahedron[][i] ~= dodekahedron[][j] <=> i~=j

xor table
------------
1 1 0
0 0 0
1 0 1
0 1 1

hope it helps somehow
-- 
"Brevity is the soul of wit." by William Shakespeare
"Debugging is twice as hard as writing the program, so if you write
the program as cleverly as you can, by definition, you won't be clever
enough to debug it." - Kernighans law



More information about the Ronja mailing list