home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13552 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  889 b 

  1. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu
  2. From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Sets in C
  5. Message-ID: <1992Sep11.203936.15198@klaava.Helsinki.FI>
  6. Date: 11 Sep 92 20:39:36 GMT
  7. References: <14390@goanna.cs.rmit.oz.au> <kjb.716185475@godzilla.cgl.citri.edu.au> <1992Sep11.132212.1489@klaava.Helsinki.FI>
  8. Organization: University of Helsinki
  9. Lines: 14
  10.  
  11. wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
  12. >    #define ELEMBIT(n) ((n) % INT_BITS)
  13. >    set[INDEX(elementnumber)] |= ELEMBIT(elementnumber)
  14.  
  15. It was pointed out to me in e-mail that the above line is, of course,
  16. incorrect.  You need to change it to 
  17.  
  18.     set[INDEX(elementnumber)] |= 1 << ELEMBIT(elementnumber)
  19.  
  20. Also, the method I outlined works, but the code should not be taken as a
  21. guideline, only as a demonstration of the principle.
  22.  
  23. --
  24. Lars.Wirzenius@helsinki.fi
  25.