69 if ( numBits > (
maxSize << 3 ) ) {
119 if ( numBits == 0 || numBits < -31 || numBits > 32 ) {
125 if ( numBits != 32 ) {
127 if ( value > ( 1 << numBits ) - 1 ) {
129 }
else if ( value < 0 ) {
133 int r = 1 << ( - 1 - numBits );
134 if ( value > r - 1 ) {
136 }
else if ( value < -r ) {
158 if ( put > numBits ) {
161 fraction = value & ( ( 1 << put ) - 1 );
165 writeBit = ( writeBit + put ) & 7;
183 if ( maxLength >= 0 && l >= maxLength ) {
187 bytePtr =
reinterpret_cast<const byte *
>(
s);
189 for ( i = 0; i <
l; i++ ) {
190 if ( bytePtr[i] > 127 ) {
193 dataPtr[
i] = bytePtr[
i];
197 for ( i = 0; i <
l; i++ ) {
198 dataPtr[
i] = bytePtr[
i];
222 memcpy( dataPtr, adr.
ip, 4 );
232 if ( oldValue == newValue ) {
248 x = oldValue ^ newValue;
249 for ( i = 7; i > 0; i-- ) {
250 if ( x & ( 1 << i ) ) {
257 WriteBits( ( ( 1 << i ) - 1 ) & newValue, i );
269 x = oldValue ^ newValue;
270 for ( i = 15; i > 0; i-- ) {
271 if ( x & ( 1 << i ) ) {
278 WriteBits( ( ( 1 << i ) - 1 ) & newValue, i );
290 x = oldValue ^ newValue;
291 for ( i = 31; i > 0; i-- ) {
292 if ( x & ( 1 << i ) ) {
299 WriteBits( ( ( 1 << i ) - 1 ) & newValue, i );
311 bool changed =
false;
313 if ( base !=
NULL ) {
374 if ( numBits == 0 || numBits < -31 || numBits > 32 ) {
393 while ( valueBits < numBits ) {
398 if (
get > (numBits - valueBits) ) {
399 get = numBits - valueBits;
403 fraction &= ( 1 << get ) - 1;
404 value |= fraction << valueBits;
411 if ( value & ( 1 << ( numBits - 1 ) ) ) {
412 value |= -1 ^ ( ( 1 << numBits ) - 1 );
442 if ( l < bufferSize - 1 ) {
487 for ( i = 0; i < 4; i++ ) {
518 return ( ( oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
534 return ( ( oldValue & ~( ( 1 << i ) - 1 )) | newValue );
550 return ( ( oldValue & ~( ( 1 << i ) - 1 ) ) | newValue );
561 bool changed =
false;
563 if ( base !=
NULL ) {
569 while(
ReadString( key,
sizeof( key ) ) != 0 ) {
571 dict.
Set( key, value );
575 while(
ReadString( key,
sizeof( key ) ) != 0 ) {
592 assert( numBits >= 6 && numBits <= 32 );
596 max = ( 1 << ( numBits - 1 ) ) - 1;
614 static float sign[2] = { 1.0f, -1.0f };
619 assert( numBits >= 6 && numBits <= 32 );
622 max = ( 1 << ( numBits - 1 ) ) - 1;
625 dir.
x = sign[( bits >> ( numBits * 3 - 1 ) ) & 1] * ( ( bits >> ( numBits * 2 ) ) &
max ) * invMax;
626 dir.
y = sign[( bits >> ( numBits * 2 - 1 ) ) & 1] * ( ( bits >> ( numBits * 1 ) ) &
max ) * invMax;
627 dir.
z = sign[( bits >> ( numBits * 1 - 1 ) ) & 1] * ( ( bits >> ( numBits * 0 ) ) &
max ) * invMax;
658 if ( baseValue == value ) {
679 if ( oldValue == newValue ) {
688 if ( baseValue == newValue ) {
692 if ( oldValue == newValue ) {
806 assert( length <
sizeof( baseData ) );
808 if ( memcmp( data, baseData, length ) == 0 ) {
853 if ( baseValue == newValue ) {
878 if ( baseValue == newValue ) {
903 if ( baseValue == newValue ) {
949 assert( length <
sizeof( baseData ) );
952 memcpy( data, baseData, length );
static int DirToBits(const idVec3 &dir, int numBits)
GLsizei const GLfloat * value
void ReadData(void *data, int length) const
assert(prefInfo.fullscreenBtn)
int Cmp(const char *text) const
void Delete(const char *key)
const idStr & GetKey(void) const
void WriteData(const void *data, int length)
const int MAX_DATA_BUFFER
static idVec3 BitsToDir(int bits, int numBits)
int GetRemaingData(void) const
void ReadByteAlign(void) const
void WriteBits(int value, int numBits)
int ReadDeltaByteCounter(int oldValue) const
void WriteDelta(int oldValue, int newValue, int numBits)
void ReadString(char *buffer, int bufferSize) const
int ReadString(char *buffer, int bufferSize) const
void WriteString(const char *s, int maxLength=-1, bool make7Bit=true)
void Set(const char *key, const char *value)
int ReadBits(int numBits) const
bool CheckOverflow(int numBits)
int Icmp(const char *text) const
void WriteDeltaLongCounter(int oldValue, int newValue)
int ReadDeltaShortCounter(int oldValue) const
int ReadData(void *data, int length) const
void WriteData(const void *data, int length)
int ReadUShort(void) const
const idBitMsg * readDelta
void WriteNetadr(const netadr_t adr)
bool ReadDeltaDict(idDict &dict, const idDict *base) const
int ReadDelta(int oldValue, int numBits) const
#define FLOATSIGNBITSET(f)
void WriteByteAlign(void)
void WriteDict(const idDict &dict)
int ReadDeltaByteCounter(int oldValue) const
static float Fabs(float f)
GLsizei GLsizei GLenum GLenum const GLvoid * data
virtual void virtual void FatalError(const char *fmt,...) id_attribute((format(printf
void WriteDelta(int oldValue, int newValue, int numBits)
static void Copynz(char *dest, const char *src, int destsize)
const idStr & GetValue(void) const
float NormalizeFast(void)
void ReadNetadr(netadr_t *adr) const
float LengthSqr(void) const
const idKeyValue * FindKey(const char *key) const
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void ReadDict(idDict &dict)
int ReadDeltaShortCounter(int oldValue) const
GLdouble GLdouble GLdouble r
int ReadDeltaLongCounter(int oldValue) const
void WriteDeltaShortCounter(int oldValue, int newValue)
void WriteDeltaLongCounter(int oldValue, int newValue)
int GetRemainingReadBits(void) const
bool WriteDeltaDict(const idDict &dict, const idDict *base)
int ReadDelta(int oldValue, int numBits) const
void WriteDeltaByteCounter(int oldValue, int newValue)
GLsizei const GLcharARB const GLint * length
const idKeyValue * GetKeyVal(int index) const
void WriteDeltaByteCounter(int oldValue, int newValue)
void WriteBits(int value, int numBits)
void WriteString(const char *s, int maxLength=-1)
virtual void Error(const char *fmt,...) id_attribute((format(printf
int GetNumKeyVals(void) const
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
void WriteDeltaShortCounter(int oldValue, int newValue)
byte * GetByteSpace(int length)
int ReadBits(int numBits) const
int GetRemainingWriteBits(void) const
static class idCommon * common
int ReadDeltaLongCounter(int oldValue) const