home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdarg.h>
- #include "sets.h"
- /***************************************************************************/
- boolean in_set(set *aset, int entity)
- /***************************************************************************/
- /* Determines if entity is a member. */
- {
- int bit,i;
-
- /* check to see if the set has that many words & members */
- if(entity > aset->set_size)
- return FALSE;
-
- /* get the bit */
- bit = entity % MEMBERS_PER_WORD;
-
- /* get the right word */
- i = entity / MEMBERS_PER_WORD;
-
- /* detect the bit */
- return (aset->word[i] & (1 << bit)) ? TRUE : FALSE;
-
- } /* end in_set */
-
-