| random thoughts |
|
Monday, 7. November 2005
a question of masks
craniac, 2005-11-07 08:50
I am quite comfortable with the idea of using bit masks to test variables for specific values. What came up the other day is the need to test a byte for the presence of only a single set bit, where the specific bit is not known.
I wanted to know whether the byte had any of the following values, without caring what the actual value was;
00000001
00000010
00000100
00001000
00010000
00100000
01000000
The consensus from everyone I've discussed this with is that a loop with multiple tests is required, but I can't help thinking that out there somewhere is someone that has a clever bit mask or mathematical way to test for this with a single expression.... Comment |
Online for 2191 days
Last update: 2004-10-04 00:45 status
Youre not logged in ... Login
menu
my other sites
search
calendar
recent updates
moving on I have succumbed
to the lure of Wordpress and have started a new...
by craniac (2005-12-09 17:22)
kill or cure According to
this blog entry the uninstaller that Sony has made available...
by craniac (2005-11-16 11:44)
sory seems to be the
hardest word In response to the Sony DRM fiasco, someone...
by craniac (2005-11-16 10:49)
a new internet Many years
ago I worked for a small software development company. Let's...
by craniac (2005-11-07 10:03)
a question of masks I
am quite comfortable with the idea of using bit masks...
by craniac (2005-11-07 08:50)
boycott sony! Dave Slusher over
on Evil Genius Chronicles is calling for a boycott of...
by craniac (2005-11-04 11:06)
car guards Here in South
Africa car theft is a big problem so every parking...
by craniac (2005-11-04 09:47)
pseudonym I just received a
spam e-mail from someone calling himself (or herself) Maltreatment U....
by craniac (2005-11-02 13:39)
the cry of the larger
breasted woman
Originally posted by taminator
by craniac (2005-10-25 08:59)
young entrepreneur A friend sent
me this photo, which I thought was really funny.
by craniac (2005-10-19 16:13)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||