And an even parity bit can be determined like this:
my $evenparity = unpack( '%1b*', $mask );
And you could use & to isolate the right bits with pre-calculated bit-masks.
PS: not sure why you use B64 for 32bit hex.
that's a weak demo because I don't seem to get MSB and LSB right.
DB<85> $n=pack 'h8', '3E10F67A' DB<86> undef $m0; vec($m0,$_,1)=1 for 0, 1, 3, 4, 6, 8, 10, 11, 13, + 15, 17, 19, 21, 23, 25, 26, 28, 30 DB<87> say unpack 'b32',$_ for $n, $m0, $n & $m0 11000111100000001111011011100101 11011010101101010101010101101010 11000010100000000101010001100000 DB<88> p unpack '%1b', $n & $m0 1
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re^4: ECC computation
by LanX
in thread ECC computation
by savangadi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |