sets.h 906 B

123456789101112131415161718192021222324252627282930313233
  1. /* Copyright (c) 1991 by the Vrije Universiteit, Amsterdam, the Netherlands.
  2. * For full copyright and restrictions on use see the file COPYING in the top
  3. * level of the LLgen tree.
  4. */
  5. /*
  6. * L L G E N
  7. *
  8. * An Extended LL(1) Parser Generator
  9. *
  10. * Author : Ceriel J.H. Jacobs
  11. */
  12. /*
  13. * $Id$
  14. * Some macros that deal with bitsets and their size
  15. */
  16. # define BITS (8 * sizeof (int))
  17. # define IN(a,i) ((a)[(i)/BITS] & (1<<((i) % BITS)))
  18. # define NTIN(a,i) ((a)[(i)/BITS+tsetsize]&(1<<((i)%BITS)))
  19. # define PUTIN(a,i) ((a)[(i)/BITS] |=(1<<((i) % BITS)))
  20. # define NTPUTIN(a,i) ((a)[(i)/BITS+tsetsize]|=(1<<((i)%BITS)))
  21. # define NBYTES(n) (((n) + 7) / 8)
  22. /*
  23. * The next two macros operate on byte counts!
  24. */
  25. # define NINTS(n) (((n) + (int) (sizeof(int) - 1)) / (int) sizeof(int))
  26. # define ALIGN(n) (NINTS(n) * (int) sizeof (int))
  27. extern int tsetsize;
  28. extern p_set *setptr, *maxptr;
  29. extern int nbytes;