mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-21 20:21:19 +00:00
Remove usage of long type from idlib/
Apart from some minor stuff, this changes the signature of some methods of Parser and Token classes and of the (unused) Random2 class. That no problem though, because the calling code uses normal ints anyway.
This commit is contained in:
parent
ce87a8904c
commit
a9a6042a04
7 changed files with 36 additions and 36 deletions
|
@ -44,7 +44,7 @@ static const char sixtet_to_base64[] =
|
|||
|
||||
void idBase64::Encode( const byte *from, int size ) {
|
||||
int i, j;
|
||||
unsigned long w;
|
||||
unsigned int w;
|
||||
byte *to;
|
||||
|
||||
EnsureAlloced( 4*(size+3)/3 + 2 ); // ratio and padding + trailing \0
|
||||
|
@ -94,7 +94,7 @@ idBase64::Decode
|
|||
============
|
||||
*/
|
||||
int idBase64::Decode( byte *to ) const {
|
||||
unsigned long w;
|
||||
unsigned int w;
|
||||
int i, j;
|
||||
size_t n;
|
||||
static char base64_to_sixtet[256];
|
||||
|
|
|
@ -1297,7 +1297,7 @@ typedef struct operator_s
|
|||
|
||||
typedef struct value_s
|
||||
{
|
||||
signed long int intvalue;
|
||||
int intvalue;
|
||||
double floatvalue;
|
||||
int parentheses;
|
||||
struct value_s *prev, *next;
|
||||
|
@ -1368,7 +1368,7 @@ int PC_OperatorPriority(int op) {
|
|||
|
||||
#define FreeOperator(op)
|
||||
|
||||
int idParser::EvaluateTokens( idToken *tokens, signed long int *intvalue, double *floatvalue, int integer ) {
|
||||
int idParser::EvaluateTokens( idToken *tokens, int *intvalue, double *floatvalue, int integer ) {
|
||||
operator_t *o, *firstoperator, *lastoperator;
|
||||
value_t *v, *firstvalue, *lastvalue, *v1, *v2;
|
||||
idToken *t;
|
||||
|
@ -1791,7 +1791,7 @@ int idParser::EvaluateTokens( idToken *tokens, signed long int *intvalue, double
|
|||
idParser::Evaluate
|
||||
================
|
||||
*/
|
||||
int idParser::Evaluate( signed long int *intvalue, double *floatvalue, int integer ) {
|
||||
int idParser::Evaluate( int *intvalue, double *floatvalue, int integer ) {
|
||||
idToken token, *firsttoken, *lasttoken;
|
||||
idToken *t, *nexttoken;
|
||||
define_t *define;
|
||||
|
@ -1882,7 +1882,7 @@ int idParser::Evaluate( signed long int *intvalue, double *floatvalue, int integ
|
|||
idParser::DollarEvaluate
|
||||
================
|
||||
*/
|
||||
int idParser::DollarEvaluate( signed long int *intvalue, double *floatvalue, int integer) {
|
||||
int idParser::DollarEvaluate( int *intvalue, double *floatvalue, int integer) {
|
||||
int indent, defined = false;
|
||||
idToken token, *firsttoken, *lasttoken;
|
||||
idToken *t, *nexttoken;
|
||||
|
@ -1984,7 +1984,7 @@ idParser::Directive_elif
|
|||
================
|
||||
*/
|
||||
int idParser::Directive_elif( void ) {
|
||||
signed long int value;
|
||||
int value;
|
||||
int type, skip;
|
||||
|
||||
idParser::PopIndent( &type, &skip );
|
||||
|
@ -2006,7 +2006,7 @@ idParser::Directive_if
|
|||
================
|
||||
*/
|
||||
int idParser::Directive_if( void ) {
|
||||
signed long int value;
|
||||
int value;
|
||||
int skip;
|
||||
|
||||
if ( !idParser::Evaluate( &value, NULL, true ) ) {
|
||||
|
@ -2102,7 +2102,7 @@ idParser::Directive_eval
|
|||
================
|
||||
*/
|
||||
int idParser::Directive_eval( void ) {
|
||||
signed long int value;
|
||||
int value;
|
||||
idToken token;
|
||||
char buf[128];
|
||||
|
||||
|
@ -2241,7 +2241,7 @@ idParser::DollarDirective_evalint
|
|||
================
|
||||
*/
|
||||
int idParser::DollarDirective_evalint( void ) {
|
||||
signed long int value;
|
||||
int value;
|
||||
idToken token;
|
||||
char buf[128];
|
||||
|
||||
|
@ -2290,7 +2290,7 @@ int idParser::DollarDirective_evalfloat( void ) {
|
|||
token = buf;
|
||||
token.type = TT_NUMBER;
|
||||
token.subtype = TT_FLOAT | TT_LONG | TT_DECIMAL | TT_VALUESVALID;
|
||||
token.intvalue = (unsigned long) fabs( value );
|
||||
token.intvalue = (unsigned int) fabs( value );
|
||||
token.floatvalue = fabs( value );
|
||||
idParser::UnreadSourceToken( &token );
|
||||
if ( value < 0 ) {
|
||||
|
|
|
@ -228,9 +228,9 @@ private:
|
|||
int Directive_ifndef( void );
|
||||
int Directive_else( void );
|
||||
int Directive_endif( void );
|
||||
int EvaluateTokens( idToken *tokens, signed long int *intvalue, double *floatvalue, int integer );
|
||||
int Evaluate( signed long int *intvalue, double *floatvalue, int integer );
|
||||
int DollarEvaluate( signed long int *intvalue, double *floatvalue, int integer);
|
||||
int EvaluateTokens( idToken *tokens, int *intvalue, double *floatvalue, int integer );
|
||||
int Evaluate( int *intvalue, double *floatvalue, int integer );
|
||||
int DollarEvaluate( int *intvalue, double *floatvalue, int integer);
|
||||
int Directive_define( void );
|
||||
int Directive_elif( void );
|
||||
int Directive_if( void );
|
||||
|
|
|
@ -703,7 +703,7 @@ idStr::FileNameHash
|
|||
*/
|
||||
int idStr::FileNameHash( void ) const {
|
||||
int i;
|
||||
long hash;
|
||||
int hash;
|
||||
char letter;
|
||||
|
||||
hash = 0;
|
||||
|
@ -716,7 +716,7 @@ int idStr::FileNameHash( void ) const {
|
|||
if ( letter =='\\' ) {
|
||||
letter = '/';
|
||||
}
|
||||
hash += (long)(letter)*(i+119);
|
||||
hash += (int)(letter)*(i+119);
|
||||
i++;
|
||||
}
|
||||
hash &= (FILE_HASH_SIZE-1);
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
double GetDoubleValue( void ); // double value of TT_NUMBER
|
||||
float GetFloatValue( void ); // float value of TT_NUMBER
|
||||
unsigned long GetUnsignedLongValue( void ); // unsigned long value of TT_NUMBER
|
||||
unsigned int GetUnsignedIntValue( void ); // unsigned int value of TT_NUMBER
|
||||
int GetIntValue( void ); // int value of TT_NUMBER
|
||||
int WhiteSpaceBeforeToken( void ) const;// returns length of whitespace before token
|
||||
void ClearTokenWhiteSpace( void ); // forget whitespace before token
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
void NumberValue( void ); // calculate values for a TT_NUMBER
|
||||
|
||||
private:
|
||||
unsigned long intvalue; // integer value
|
||||
unsigned int intvalue; // integer value
|
||||
double floatvalue; // floating point value
|
||||
const char * whiteSpaceStart_p; // start of white space before token, only used by idLexer
|
||||
const char * whiteSpaceEnd_p; // end of white space before token, only used by idLexer
|
||||
|
@ -141,7 +141,7 @@ ID_INLINE float idToken::GetFloatValue( void ) {
|
|||
return (float) GetDoubleValue();
|
||||
}
|
||||
|
||||
ID_INLINE unsigned long idToken::GetUnsignedLongValue( void ) {
|
||||
ID_INLINE unsigned int idToken::GetUnsignedIntValue( void ) {
|
||||
if ( type != TT_NUMBER ) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ ID_INLINE unsigned long idToken::GetUnsignedLongValue( void ) {
|
|||
}
|
||||
|
||||
ID_INLINE int idToken::GetIntValue( void ) {
|
||||
return (int) GetUnsignedLongValue();
|
||||
return (int) GetUnsignedIntValue();
|
||||
}
|
||||
|
||||
ID_INLINE int idToken::WhiteSpaceBeforeToken( void ) const {
|
||||
|
|
|
@ -100,10 +100,10 @@ ID_INLINE float idRandom::CRandomFloat( void ) {
|
|||
|
||||
class idRandom2 {
|
||||
public:
|
||||
idRandom2( unsigned long seed = 0 );
|
||||
idRandom2( unsigned int seed = 0 );
|
||||
|
||||
void SetSeed( unsigned long seed );
|
||||
unsigned long GetSeed( void ) const;
|
||||
void SetSeed( unsigned int seed );
|
||||
unsigned int GetSeed( void ) const;
|
||||
|
||||
int RandomInt( void ); // random integer in the range [0, MAX_RAND]
|
||||
int RandomInt( int max ); // random integer in the range [0, max]
|
||||
|
@ -113,26 +113,26 @@ public:
|
|||
static const int MAX_RAND = 0x7fff;
|
||||
|
||||
private:
|
||||
unsigned long seed;
|
||||
unsigned int seed;
|
||||
|
||||
static const unsigned long IEEE_ONE = 0x3f800000;
|
||||
static const unsigned long IEEE_MASK = 0x007fffff;
|
||||
static const unsigned int IEEE_ONE = 0x3f800000;
|
||||
static const unsigned int IEEE_MASK = 0x007fffff;
|
||||
};
|
||||
|
||||
ID_INLINE idRandom2::idRandom2( unsigned long seed ) {
|
||||
ID_INLINE idRandom2::idRandom2( unsigned int seed ) {
|
||||
this->seed = seed;
|
||||
}
|
||||
|
||||
ID_INLINE void idRandom2::SetSeed( unsigned long seed ) {
|
||||
ID_INLINE void idRandom2::SetSeed( unsigned int seed ) {
|
||||
this->seed = seed;
|
||||
}
|
||||
|
||||
ID_INLINE unsigned long idRandom2::GetSeed( void ) const {
|
||||
ID_INLINE unsigned int idRandom2::GetSeed( void ) const {
|
||||
return seed;
|
||||
}
|
||||
|
||||
ID_INLINE int idRandom2::RandomInt( void ) {
|
||||
seed = 1664525L * seed + 1013904223L;
|
||||
seed = 1664525 * seed + 1013904223;
|
||||
return ( (int) seed & idRandom2::MAX_RAND );
|
||||
}
|
||||
|
||||
|
@ -144,15 +144,15 @@ ID_INLINE int idRandom2::RandomInt( int max ) {
|
|||
}
|
||||
|
||||
ID_INLINE float idRandom2::RandomFloat( void ) {
|
||||
unsigned long i;
|
||||
seed = 1664525L * seed + 1013904223L;
|
||||
unsigned int i;
|
||||
seed = 1664525 * seed + 1013904223;
|
||||
i = idRandom2::IEEE_ONE | ( seed & idRandom2::IEEE_MASK );
|
||||
return ( ( *(float *)&i ) - 1.0f );
|
||||
}
|
||||
|
||||
ID_INLINE float idRandom2::CRandomFloat( void ) {
|
||||
unsigned long i;
|
||||
seed = 1664525L * seed + 1013904223L;
|
||||
unsigned int i;
|
||||
seed = 1664525 * seed + 1013904223;
|
||||
i = idRandom2::IEEE_ONE | ( seed & idRandom2::IEEE_MASK );
|
||||
return ( 2.0f * ( *(float *)&i ) - 3.0f );
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ void idSIMD::Shutdown( void ) {
|
|||
|
||||
idSIMDProcessor *p_simd;
|
||||
idSIMDProcessor *p_generic;
|
||||
long baseClocks = 0;
|
||||
int baseClocks = 0;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
|
@ -155,7 +155,7 @@ long baseClocks = 0;
|
|||
|
||||
#pragma warning(disable : 4731) // frame pointer register 'ebx' modified by inline assembly code
|
||||
|
||||
long saved_ebx = 0;
|
||||
int saved_ebx = 0;
|
||||
|
||||
#define StartRecordTime( start ) \
|
||||
__asm mov saved_ebx, ebx \
|
||||
|
|
Loading…
Reference in a new issue