bitset.h 993 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * bitset.h - Arbitrary-length bit sets
  3. *
  4. * Written 2010 by Werner Almesberger
  5. * Copyright 2010 by Werner Almesberger
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. */
  12. #ifndef BITSET_H
  13. #define BITSET_H
  14. struct bitset;
  15. struct bitset *bitset_new(int n);
  16. struct bitset *bitset_clone(const struct bitset *old);
  17. void bitset_free(struct bitset *set);
  18. void bitset_set(struct bitset *set, int n);
  19. void bitset_clear(struct bitset *set, int n);
  20. int bitset_pick(const struct bitset *set, int n);
  21. int bitset_is_empty(const struct bitset *set);
  22. void bitset_zero(struct bitset *a);
  23. void bitset_and(struct bitset *a, const struct bitset *b);
  24. void bitset_or(struct bitset *a, const struct bitset *b);
  25. int bitset_ge(const struct bitset *a, const struct bitset *b);
  26. #endif /* !BITSET_H */