home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
c
/
cnews016.arc
/
SETS.ARC
/
SETSOURC.ARC
/
DELMEMBR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-03-09
|
942b
|
38 lines
#include <stdio.h>
#include <stdarg.h>
#include "sets.h"
/***************************************************************************/
int del_member(set *aset, int member)
/***************************************************************************/
/* resets a bit in the member'th bit place of the set's member record. */
{
int wrd,bit,i;
/* check to see if the set has that many words & members */
if(member > aset->set_size)
return FAILURE;
/* get the bit */
bit = member % MEMBERS_PER_WORD;
/* get the right word */
i = member / MEMBERS_PER_WORD;
/* test the bit to see if it's already there */
wrd = 1 << bit;
if(wrd & aset->word[i] == 0)
return NOCHANGE; /* it's already deleted */
else {
/* reset the bit */
aset->word[i] &= ~(1 << bit);
/* update the member count */
aset->nmembers -= 1;
}
/* done */
return SUCCESS;
} /* end del_member */