1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 /* Sets bit Y starting at address X. */
25 #define SET_BIT(X, Y) \
26 (((unsigned char *) X)[(Y) / CHAR_BIT] |= 1 << ((Y) % CHAR_BIT))
28 /* Clears bit Y starting at address X. */
29 #define CLEAR_BIT(X, Y) \
30 (((unsigned char *) X)[(Y) / CHAR_BIT] &= ~(1 << ((Y) % CHAR_BIT)))
32 /* Sets bit Y starting at address X to Z, which is zero/nonzero */
33 #define SET_BIT_TO(X, Y, Z) \
34 ((Z) ? SET_BIT(X, Y) : CLEAR_BIT(X, Y))
36 /* Nonzero if bit Y starting at address X is set. */
37 #define TEST_BIT(X, Y) \
38 (((unsigned char *) X)[(Y) / CHAR_BIT] & (1 << ((Y) % CHAR_BIT)))
40 /* Returns 2**X, 0 <= X < 32. */
41 #define BIT_INDEX(X) (1ul << (X))
43 #endif /* bitvector.h */