home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!tamsun.ta!cs.tamu.edu!tpradeep
- From: tpradeep@cs.tamu.edu
- Newsgroups: comp.lang.c
- Date: 17 Jul 92 18:37 MDT
- Subject: How to implement a bit array?
- Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
- Message-ID: <1992Jul17.143744.12549@tamsun.ta>
- Nf-ID: #N:1992Jul17.143744.12549@tamsun.ta:-1367172306:001:633
- Nf-From: cs.tamu.edu!tpradeep Jul 17 18:37:00 1992
- Lines: 27
-
-
- Howdy netters,
-
- In my project I need an array of 30000 elements which have {0,1} values only.
- I guesss a good way to implement this is such that each element takes just
- one bit. Can someone suggest me a good struct/union implementation for
- a bit array.
-
- Ideally I should be able to do the following operations:
-
- whatever.whatever...[13467] = 1; // or 0
-
- if( whatever.whatever...[i] ) { code }
-
- However the following is acceptable ( worst case)
-
- BitSet(Array, 13467, 1);
-
- if( IsBitSet(Array, i) ) { code }
-
-
- Thank you for your help. If need be, I'll summerize the responses on the net.
-
- Pradeep
- tpradeep@cs.tamu.edu
-
-
-