in reply to Re^8: ECC computation
in thread ECC computation

OK, so just reverse all the masks and store the bits in reverse order into each @r:
my @masks = qw( 01010110101010101010110101011011 10011011001100110011011001101101 11100011110000111100011110001110 00000011111111000000011111110000 00000011111111111111100000000000 11111100000000000000000000000000 11111111111111111111111111111111 ); sub ecc { my ($hex) = @_; my $d = unpack 'B32', pack 'H8', $hex; my @r; unshift @r, unpack '%1B*', $_ & $d for @masks; $r[0] = unpack '%1B*', $r[0] . join "", @r[ 1 .. $#r ]; return join "", @r }
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^10: ECC computation
by savangadi (Initiate) on Jan 07, 2020 at 17:10 UTC
    Thanks a bunch! This is working very efficiently!