portable types
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
ULONG randseed = time(NULL);
|
unsigned long randseed = time(NULL);
|
||||||
|
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
@@ -632,7 +632,7 @@ unsigned int GetHashForDirectory( CString sDir )
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD GetFileSizeInBytes( const CString &sFilePath )
|
unsigned GetFileSizeInBytes( const CString &sFilePath )
|
||||||
{
|
{
|
||||||
HANDLE hFile = CreateFile(
|
HANDLE hFile = CreateFile(
|
||||||
sFilePath, // pointer to name of the file
|
sFilePath, // pointer to name of the file
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ inline float max(int a, float b) { return a > b? a:b; }
|
|||||||
// Fast random number generators
|
// Fast random number generators
|
||||||
// Taken from "Numerical Recipes in C"
|
// Taken from "Numerical Recipes in C"
|
||||||
|
|
||||||
extern ULONG randseed;
|
extern unsigned long randseed;
|
||||||
|
|
||||||
inline ULONG Random()
|
inline unsigned long Random()
|
||||||
{
|
{
|
||||||
randseed = 1664525L * randseed + 1013904223L;
|
randseed = 1664525L * randseed + 1013904223L;
|
||||||
return randseed;
|
return randseed;
|
||||||
@@ -73,7 +73,7 @@ inline ULONG Random()
|
|||||||
inline float RandomFloat()
|
inline float RandomFloat()
|
||||||
{
|
{
|
||||||
randseed = 1664525L * randseed + 1013904223L;
|
randseed = 1664525L * randseed + 1013904223L;
|
||||||
ULONG itemp = 0x3f800000 | (0x007fffff & randseed);
|
unsigned long itemp = 0x3f800000 | (0x007fffff & randseed);
|
||||||
return (*(float *)&itemp) - 1.0f;
|
return (*(float *)&itemp) - 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ inline int RandomInt(int nLow, int nHigh)
|
|||||||
// Simple function for generating random numbers
|
// Simple function for generating random numbers
|
||||||
inline float randomf( const float low=-1.0f, const float high=1.0f )
|
inline float randomf( const float low=-1.0f, const float high=1.0f )
|
||||||
{
|
{
|
||||||
return low + ( high - low ) * ( (FLOAT)rand() ) / RAND_MAX;
|
return low + ( high - low ) * ( (float)rand() ) / RAND_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: These are C99 functions (except for the roundf(double) overload); what's
|
/* XXX: These are C99 functions (except for the roundf(double) overload); what's
|
||||||
@@ -173,7 +173,7 @@ unsigned int GetHashForDirectory( CString sDir ); // a hash value that remains t
|
|||||||
bool DoesFileExist( const CString &sPath );
|
bool DoesFileExist( const CString &sPath );
|
||||||
bool IsAFile( const CString &sPath );
|
bool IsAFile( const CString &sPath );
|
||||||
bool IsADirectory( const CString &sPath );
|
bool IsADirectory( const CString &sPath );
|
||||||
DWORD GetFileSizeInBytes( const CString &sFilePath );
|
unsigned GetFileSizeInBytes( const CString &sFilePath );
|
||||||
|
|
||||||
bool CompareCStringsAsc(const CString &str1, const CString &str2);
|
bool CompareCStringsAsc(const CString &str1, const CString &str2);
|
||||||
bool CompareCStringsDesc(const CString &str1, const CString &str2);
|
bool CompareCStringsDesc(const CString &str1, const CString &str2);
|
||||||
|
|||||||
Reference in New Issue
Block a user