in reply to Building a byte to test truth table
Now, as long as you don't duplicate bit positions, you run into far less chances of fubar'ing the code should you insert tests, etc.# # $word is 0, the default setting for bits being 0FF # $word = 0; $word |= 0x01 if ($obj->{organization} !~ /^\s*$/); ... $word |= 0x40 if ($obj->{report} !~ /^\s*$/); print "All fields supplied" if ($word == 0x00); print "Missing Organization" if ($word & 0x01 == 0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: (jcwren) RE: Building a byte to test truth table
by dws (Chancellor) on Nov 02, 2000 at 08:25 UTC | |
by PsychoSpunk (Hermit) on Nov 03, 2000 at 05:25 UTC | |
|
RE: (jcwren) RE: Building a byte to test truth table
by PsychoSpunk (Hermit) on Nov 02, 2000 at 02:03 UTC |