Is it looking any better? Thanks, RVsub isbitset { my $bytetocheck = $_[0]; my $bittocheck = $_[1]; if (($bytetocheck >> $bittocheck) & 1) { return 1; } else { return 0; } } # End of isbitset function. ################################################## # I am testing all 8 bits to see which one is set. ################################################## printf ("\tByte %08b bit 0 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 0)); printf ("\tByte %08b bit 1 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 1)); printf ("\tByte %08b bit 2 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 2)); printf ("\tByte %08b bit 3 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 3)); printf ("\tByte %08b bit 4 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 4)); printf ("\tByte %08b bit 5 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 5)); printf ("\tByte %08b bit 6 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 6)); printf ("\tByte %08b bit 7 => %d\n\n", ord $uh[0], &isbitset((ord $uh[0]), 7));
In reply to Re: Help comparing data in byte by shifting (>>) bits
by unixhome
in thread Help comparing data in byte by shifting (>>) bits
by unixhome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |