more that 32 flag array testing

Steve Brailsford fsb at vitro.uucp
Tue Oct 9 02:51:54 AEST 1990


This talk about how many bits set in a long has reminded me of a
problem I have with finding a good efficient, fast storage
mechanism for storing 100 boolean flags.  Basically, I have
am algorithm that needs to mark one of 100 flags true, (after
they have all been inited to false.)  And then to scan through
the flags to perform operations on those that get set.  I set
aside an array of 100 chars and just set each one to 0 or 1.
I couldn't think of a way to use 100 bits worth of storage
without it getting really hairy computationally.  If I use
enums and test some location, locations are maxed at 32 bits.
How could I find if the 33 bit was set without having some
array of longs.  The problem is even more complex in the fact
that the 100 comes from 10x10, a defined size.  If I say it's
now 20x20, I would have to write the 100 bit test stuff all over.
Anyone done anything like this?


    Steve Brailsford		Usenet:  uunet!media!vitro!fsb
    Vitro Corporation		Compu$erve: 73427,1466
    14000 Georgia Ave.		Voice:  (301) 231-1481
    Silver Spring, MD 20906


-- 

    Steve Brailsford		Usenet:  uunet!media!vitro!fsb
    Vitro Corporation		Compu$erve: 73427,1466
    14000 Georgia Ave.		Voice:  (301) 231-1481



More information about the Comp.lang.c mailing list