mud++0.35/etc/
mud++0.35/etc/guilds/
mud++0.35/help/propert/
mud++0.35/mudC/
mud++0.35/player/
mud++0.35/src/interface/
mud++0.35/src/os/cygwin32/
mud++0.35/src/os/win32/
mud++0.35/src/os/win32/bcppbuilder/
mud++0.35/src/osaddon/
mud++0.35/src/util/
/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project.  All 
................................................ contributions are welcome. 
....Copyright(C).1995.Melvin.Smith.............. Enjoy. 
------------------------------------------------------------------------------
Melvin Smith (aka Fusion)         msmith@hom.net 
MUD++ development mailing list    mudpp@van.ml.org
------------------------------------------------------------------------------
bit.h
*/

#ifndef _BIT_H
#define _BIT_H
#include <string.h>
#include "string.h"

#define BIT( num ) ( 1 << num )

struct bitType
{
	const char *name;
	int val;
};


inline void SET_BIT( unsigned long flags[], int bit )
{
	flags[bit / 32] |=  ( 1 << ( bit % 32 ) );
}

inline void CLR_BIT( unsigned long flags[], int bit )
{
	flags[bit / 32] &= ~( 1 << ( bit % 32 ) );
}

inline int IS_SET( const unsigned long flags[], int bit )
{
	return flags[bit / 32] &   ( 1 << ( bit % 32 ) );
}

inline void TOGGLE_BIT( unsigned long flags[], int bit )
{
	flags[bit / 32] ^=  ( 1 << ( bit % 32 ) );
}

const int NULLBIT		= 0;    // First bit unused in all bit fields.
const int UNDEFINED		= NULLBIT;
extern const char * unknown_bit_name;

const char * lookupBitName( const bitType bit_list[], int );
int lookupBit( const bitType bit_list[], const char * );
const char * listBits( const bitType bit_list[], unsigned long bits[] );
void interpretBitList( const bitType bit_list[], unsigned long * bits[], 
								const String & arg );

#endif