reduced scope of constants

This commit is contained in:
Jeff Hill
2002-03-22 21:24:07 +00:00
parent c29f688c24
commit 017bf6f96d
4 changed files with 13 additions and 16 deletions

View File

@@ -29,12 +29,6 @@ private:
ca_uint8_t pri;
};
// start with a very small server table to speed
// up the flush traverse for the frequent case -
// a small numbers of servers
static const unsigned caServerMinIndexBitWidth = 2u;
static const unsigned caServerMaxIndexBitWidth = 32u;
inline caServerID::caServerID (
const struct sockaddr_in & addrIn, unsigned priorityIn ) :
addr ( addrIn ), pri ( static_cast <ca_uint8_t> ( priorityIn ) )
@@ -56,12 +50,18 @@ inline bool caServerID::operator == ( const caServerID & rhs ) const
inline resTableIndex caServerID::hash () const
{
// start with a very small server table to speed
// up the flush traverse for the frequent case -
// a small numbers of servers
const unsigned caServerMinIndexBitWidth = 2u;
const unsigned caServerMaxIndexBitWidth = 32u;
unsigned index;
index = this->addr.sin_addr.s_addr;
index ^= this->addr.sin_port;
index ^= this->addr.sin_port >> 8u;
index ^= this->pri;
return integerHash( caServerMinIndexBitWidth,
return integerHash ( caServerMinIndexBitWidth,
caServerMaxIndexBitWidth, index );
}

View File

@@ -26,9 +26,6 @@ private:
struct sockaddr_in addr;
};
static const unsigned inetAddrMinIndexBitWidth = 8u;
static const unsigned inetAddrMaxIndexBitWidth = 32u;
inline inetAddrID::inetAddrID ( const struct sockaddr_in & addrIn ) :
addr ( addrIn )
{
@@ -46,6 +43,8 @@ inline bool inetAddrID::operator == ( const inetAddrID &rhs ) const
inline resTableIndex inetAddrID::hash () const
{
const unsigned inetAddrMinIndexBitWidth = 8u;
const unsigned inetAddrMaxIndexBitWidth = 32u;
unsigned index;
index = this->addr.sin_addr.s_addr;
index ^= this->addr.sin_port;

View File

@@ -889,9 +889,6 @@ inline const char * stringId::resourceName () const
return this->pStr;
}
static const unsigned stringIdMinIndexWidth = CHAR_BIT;
static const unsigned stringIdMaxIndexWidth = sizeof ( unsigned );
#ifdef instantiateRecourceLib
//
@@ -968,6 +965,8 @@ stringId::~stringId()
//
resTableIndex stringId::hash() const
{
const unsigned stringIdMinIndexWidth = CHAR_BIT;
const unsigned stringIdMaxIndexWidth = sizeof ( unsigned );
const unsigned char *pUStr =
reinterpret_cast < const unsigned char * > ( this->pStr );

View File

@@ -175,14 +175,13 @@ private:
fdReg & operator = ( const fdReg & );
};
static const unsigned fdManagerHashTableMinIndexBits = 8;
static const unsigned fdManagerHashTableMaxIndexBits = sizeof(SOCKET)*CHAR_BIT;
//
// fdRegId::hash()
//
inline resTableIndex fdRegId::hash () const
{
const unsigned fdManagerHashTableMinIndexBits = 8;
const unsigned fdManagerHashTableMaxIndexBits = sizeof(SOCKET)*CHAR_BIT;
resTableIndex hashid;
hashid = integerHash ( fdManagerHashTableMinIndexBits,