in reply to Re^3: ECC computation
in thread ECC computation
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: ECC computation
by choroba (Cardinal) on Jan 05, 2020 at 21:35 UTC | |
by LanX (Saint) on Jan 05, 2020 at 22:24 UTC | |
by choroba (Cardinal) on Jan 05, 2020 at 22:28 UTC | |
by LanX (Saint) on Jan 05, 2020 at 22:42 UTC | |
by savangadi (Initiate) on Jan 06, 2020 at 20:04 UTC | |
by choroba (Cardinal) on Jan 07, 2020 at 09:47 UTC | |
|