Re: [Circle] BitVectors

From: Craig Lisowski (clisowsk@mcs.kent.edu)
Date: 11/15/96


>When defining bitvectors... I noticed that the stock code usually has the
> number go from 1,2,4,8... but there usually is only about 4 options, so it
> only goes to about 4 - 8. But now I've added more #defines and if I follow
> the pattern of doubling the number, I get all the way up to 131072... Now I
> dont know if its just me, or that's absolutely wrong. So I guess my
> question is, do you HAVE TO double the numbers like they have it done, or
> can I just go 1,2,3,4,5 and so on to 15 without getting such a large number?

	Actually, you can do things much simpler than doubling the numbers,
just use (1 << n) Where 'n' is the option from 0 through 31.

ie:
#define OPTION_1	(1 << 0)
#define OPTION_2	(1 << 1)
#define OPTION_3	(1 << 2)
...
#define OPTION_32	(1 << 31)

--Craig
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST