From c2587c76f1b416cdbecb979e54941933246bf856 Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Tue, 16 Feb 2021 20:14:16 -0600 Subject: starting over --- src/bitset.c | 86 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'src/bitset.c') diff --git a/src/bitset.c b/src/bitset.c index c08dcc7..34e6e6e 100644 --- a/src/bitset.c +++ b/src/bitset.c @@ -2,12 +2,12 @@ Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. - All Rights Reserved + All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. @@ -29,71 +29,71 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. bitset newbitset(nbits) - int nbits; + int nbits; { - int nbytes = NBYTES(nbits); - bitset ss = NEW(BYTE, nbytes); - - if (ss == NULL) - fatal("no mem for bitset"); - - ss += nbytes; - while (--nbytes >= 0) - *--ss = 0; - return ss; + int nbytes = NBYTES(nbits); + bitset ss = NEW(BYTE, nbytes); + + if (ss == NULL) + fatal("no mem for bitset"); + + ss += nbytes; + while (--nbytes >= 0) + *--ss = 0; + return ss; } void delbitset(ss) - bitset ss; + bitset ss; { - DEL(ss); + DEL(ss); } int addbit(ss, ibit) - bitset ss; - int ibit; + bitset ss; + int ibit; { - int ibyte = BIT2BYTE(ibit); - BYTE mask = BIT2MASK(ibit); - - if (ss[ibyte] & mask) - return 0; /* Bit already set */ - ss[ibyte] |= mask; - return 1; + int ibyte = BIT2BYTE(ibit); + BYTE mask = BIT2MASK(ibit); + + if (ss[ibyte] & mask) + return 0; /* Bit already set */ + ss[ibyte] |= mask; + return 1; } #if 0 /* Now a macro */ int testbit(ss, ibit) - bitset ss; - int ibit; + bitset ss; + int ibit; { - return (ss[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0; + return (ss[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0; } #endif int samebitset(ss1, ss2, nbits) - bitset ss1, ss2; - int nbits; + bitset ss1, ss2; + int nbits; { - int i; - - for (i = NBYTES(nbits); --i >= 0; ) - if (*ss1++ != *ss2++) - return 0; - return 1; + int i; + + for (i = NBYTES(nbits); --i >= 0; ) + if (*ss1++ != *ss2++) + return 0; + return 1; } void mergebitset(ss1, ss2, nbits) - bitset ss1, ss2; - int nbits; + bitset ss1, ss2; + int nbits; { - int i; - - for (i = NBYTES(nbits); --i >= 0; ) - *ss1++ |= *ss2++; + int i; + + for (i = NBYTES(nbits); --i >= 0; ) + *ss1++ |= *ss2++; } -- cgit v1.2.3