Bit map algorithms needed

Jim Harkins jharkins at sagpd1.UUCP
Sat May 26 09:12:47 AEST 1990


I need to implement what I think of as a sliding window over a long string
of bits.  I have a bitmap spread across several words and I need to find
a set of N adjacent bits that are set, and it should easily cross word
boundries.  In other words, not only are bits 4 and 5 of word 0 adjacent,
so are bits 31 of word 0 and bit 0 of word 1.  My string of N adjacent bits
can be up to 16 bits long, and the bitmap will probably be about 20 words
long (at 32 bits per word, but portability would be nice).  It's perfectly
OK to look for the string in whole words before going back to span edges.
That is, if word 0 is AAAA and word 1 is 5555 then it's ok to look for 2
adjacent bits in word 0, then word 1, then the boundry between the words.

I think this kind of thing is used a lot in bit mapped graphics, so does anyone
have an algorithm or pointer to an algorithm I can use?  I'm running C on a
68000 chip, but portability would be nice.

Thanks in advance.


-- 
jim		jharkins at sagpd1

I *still* don't know who killed Laura Palmer!



More information about the Comp.lang.c mailing list