1. piont me in the right direction please

Hello,

Sorry for bothering yall with something like this but, yall pros always have the best website knowledge. I was wondering if anyone knew a good page that helps learning bitvectors. I am pretty comfortable with coding know but am lost when it comes to bits and binary. Exp. I am learning the tbamud code and it uses binary flags for player toggles, preferences, affect flags and much more.

It works on a 128-bit binary flag system, and right there I am lost.

Thank you for any advice or redirection given, it is very much apprciated.
Cindy

2. If by "bitvectors" you mean bit fields than here it is what you can find on wikipedia:

http://en.wikipedia.org/wiki/Bitfield
http://www.cs.cf.ac.uk/Dave/C/node13.html

3. Thank you very much. I am not 100% sure if that is what he meant, here is how he told me. This was the question I first asked.

Why do alot of define's shift the operands?

Code:
```/* Exit info: used in room_data.dir_option.exit_info */
#define EX_ISDOOR     (1 << 0)   /**< Exit is a door		*/
#define EX_CLOSED     (1 << 1)   /**< The door is closed	*/
#define EX_LOCKED     (1 << 2)   /**< The door is locked	*/
#define EX_PICKPROOF  (1 << 3)   /**< Lock can't be picked	*/```
This is the response he gave me.

These are used for binary flags (often called bitvectors in the MUD code). These are used a lot in the MUD code, for player toggles, preferences, affect flags and much more. They are defined like this because it makes it easier to read than 1, 2, 4, 8, 16, 32, 64, etc... You can see at a glance how many flags you have, just by looking at how many shifts to the left are done on the last flag.

tbaMUD works on a 128-bit binary flag system, although it's expandable to almost as many bits as you want. An integer is made up of 32 binary digits, so a 'bitvector' variable is usually an array of 4 integers.

The old CircleMUD didn't have 128-bit flags - it was limited to 32-bits. For this reason, where CircleMUD used the IS_SET(var, flag) flag check, and the SET_BIT, REMOVE_BIT and TOGGLE_BIT handlers, these couldn't be totally removed. In the above, 'var' was a single integer value, consisting of 32 flags.

New defines were therefore created to handle an array of integers to be used as flags. These are IS_SET_AR, SET_BIT_AR, REMOVE_BIT_AR and TOGGLE_BIT_AR. When dealing with integer arrays, these should be the ones to use.

4. Do a tutorial on bitshifting, bitfields or bitmasks and you'll figure it out. They are very common in C and you have certainly been using them without knowing it, eg:
Code:
`open(file, O_RDONLY);`

I'm sure the fact that "It works on a 128-bit binary flag system" is really irrelevant, so don't worry about it (that's a lot of flags I guess).

I am not 100% sure if that is what he meant
I am, for what that is worth. But I don't think you will find the term "bitvector" used very much, is all. It is the same thing (an array of bit values).

5. Ah yes, you are really looking at a bit vector. Imagine if you wanted to record up to 128 "yes/no" options. One way is to create an array of 128 ints, and then designate 0 for "no" and 1 for "yes". The bit vector here works on the same concept, except that instead of using 128 ints, it uses 128 bits stored in an array of just 4 ints, each int presumably being of 4 bytes, and each byte presumably being of 8 bits. Of course, this means that instead of accessing the options via an array, you now access the options using bitwise operations (and some array operations to get to the desired int).

6. Thank you so very much for you very timely answers once agin, always get the nicest and best answers from the forums here.

Thank you agin fellows, looking for some tutorials now.

7. "bitvector" is more commonly known as a "bitmap".