Revert "Get rid of MSVC's __int64"

This reverts commit d63f79325f.
This commit is contained in:
void_17
2026-03-02 17:39:35 +07:00
parent 119bff3514
commit b9a2951901
308 changed files with 5368 additions and 5360 deletions

View File

@@ -40,7 +40,7 @@ SparseDataStorage::SparseDataStorage()
// Data and count packs together the pointer to our data and the count of planes allocated - 127 planes allocated in this case
#pragma warning ( disable : 4826 )
dataAndCount = 0x007F000000000000L | (( (int64_t) planeIndices ) & 0x0000ffffffffffffL);
dataAndCount = 0x007F000000000000L | (( (__int64) planeIndices ) & 0x0000ffffffffffffL);
#pragma warning ( default : 4826 )
#ifdef DATA_COMPRESSION_STATS
count = 128;
@@ -59,7 +59,7 @@ SparseDataStorage::SparseDataStorage(bool isUpper)
// Data and count packs together the pointer to our data and the count of planes allocated - 127 planes allocated in this case
#pragma warning ( disable : 4826 )
dataAndCount = 0x0000000000000000L | (( (int64_t) planeIndices ) & 0x0000ffffffffffffL);
dataAndCount = 0x0000000000000000L | (( (__int64) planeIndices ) & 0x0000ffffffffffffL);
#pragma warning ( default : 4826 )
#ifdef DATA_COMPRESSION_STATS
count = 128;
@@ -70,7 +70,7 @@ SparseDataStorage::~SparseDataStorage()
{
unsigned char *indicesAndData = (unsigned char *)(dataAndCount & 0x0000ffffffffffff);
// Determine correct means to free this data - could have been allocated either with XPhysicalAlloc or malloc
#ifdef _XBOX
if( (unsigned int)indicesAndData >= MM_PHYSICAL_4KB_BASE )
{
@@ -87,7 +87,7 @@ SparseDataStorage::~SparseDataStorage()
SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom)
{
// Extra details of source storage
int64_t sourceDataAndCount = copyFrom->dataAndCount;
__int64 sourceDataAndCount = copyFrom->dataAndCount;
unsigned char *sourceIndicesAndData = (unsigned char *)(sourceDataAndCount & 0x0000ffffffffffff);
int sourceCount = (sourceDataAndCount >> 48 ) & 0xffff;
@@ -97,7 +97,7 @@ SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom)
// AP - I've moved this to be before the memcpy because of a very strange bug on vita. Sometimes dataAndCount wasn't valid in time when ::get was called.
// This should never happen and this isn't a proper solution but fixes it for now.
#pragma warning ( disable : 4826 )
dataAndCount = ( sourceDataAndCount & 0xffff000000000000L ) | ( ((int64_t) destIndicesAndData ) & 0x0000ffffffffffffL );
dataAndCount = ( sourceDataAndCount & 0xffff000000000000L ) | ( ((__int64) destIndicesAndData ) & 0x0000ffffffffffffL );
#pragma warning ( default : 4826 )
XMemCpy( destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128 );
@@ -126,7 +126,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
for( int y = 0; y < 128; y++ )
{
bool all0 = true;
for( int xz = 0; xz < 256; xz++ ) // 256 in loop as 16 x 16 separate bytes need checked
{
int pos = ( xz << 7 ) | y;
@@ -176,9 +176,9 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset)
// Get new data and count packed info
#pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) planeIndices) & 0x0000ffffffffffffL;
__int64 newDataAndCount = ((__int64) planeIndices) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 )
newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48;
newDataAndCount |= ((__int64)allocatedPlaneCount) << 48;
updateDataAndCount( newDataAndCount );
}
@@ -230,7 +230,7 @@ int SparseDataStorage::get(int x, int y, int z)
{
unsigned char *planeIndices, *data;
getPlaneIndicesAndData(&planeIndices, &data);
if( planeIndices[y] == ALL_0_INDEX )
{
return 0;
@@ -370,7 +370,7 @@ int SparseDataStorage::getDataRegion(byteArray dataInOut, int x0, int y0, int z0
}
}
ptrdiff_t count = pucOut - &dataInOut.data[offset];
return (int)count;
}
@@ -380,7 +380,7 @@ void SparseDataStorage::addNewPlane(int y)
do
{
// Get last packed data pointer & count
int64_t lastDataAndCount = dataAndCount;
__int64 lastDataAndCount = dataAndCount;
// Unpack count & data pointer
int lastLinesUsed = (int)(( lastDataAndCount >> 48 ) & 0xffff);
@@ -388,9 +388,9 @@ void SparseDataStorage::addNewPlane(int y)
// Find out what to prefill the newly allocated line with
unsigned char planeIndex = lastDataPointer[y];
if( planeIndex < ALL_0_INDEX ) return; // Something has already allocated this line - we're done
int linesUsed = lastLinesUsed + 1;
// Allocate new memory storage, copy over anything from old storage, and initialise remainder
@@ -401,14 +401,14 @@ void SparseDataStorage::addNewPlane(int y)
// Get new data and count packed info
#pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL;
__int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 )
newDataAndCount |= ((int64_t)linesUsed) << 48;
newDataAndCount |= ((__int64)linesUsed) << 48;
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
__int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
if( lastDataAndCount2 == lastDataAndCount )
{
success = true;
@@ -473,20 +473,20 @@ void SparseDataStorage::tick()
}
// Update storage with a new values for dataAndCount, repeating as necessary if other simultaneous writes happen.
void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount)
void SparseDataStorage::updateDataAndCount(__int64 newDataAndCount)
{
// Now actually assign this data to the storage. Just repeat until successful, there isn't any useful really that we can merge the results of this
// with any other simultaneous writes that might be happening.
bool success = false;
do
{
int64_t lastDataAndCount = dataAndCount;
__int64 lastDataAndCount = dataAndCount;
unsigned char *lastDataPointer = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff);
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
__int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
if( lastDataAndCount2 == lastDataAndCount )
{
success = true;
@@ -508,7 +508,7 @@ int SparseDataStorage::compress()
unsigned char _planeIndices[128];
bool needsCompressed = false;
int64_t lastDataAndCount = dataAndCount;
__int64 lastDataAndCount = dataAndCount;
unsigned char *planeIndices = (unsigned char *)(lastDataAndCount & 0x0000ffffffffffff);
unsigned char *data = planeIndices + 128;
@@ -558,13 +558,13 @@ int SparseDataStorage::compress()
// Get new data and count packed info
#pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) newIndicesAndData) & 0x0000ffffffffffffL;
__int64 newDataAndCount = ((__int64) newIndicesAndData) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 )
newDataAndCount |= ((int64_t)planesToAlloc) << 48;
newDataAndCount |= ((__int64)planesToAlloc) << 48;
// Attempt to update the data & count atomically. This command will Only succeed if the data stored at
// dataAndCount is equal to lastDataAndCount, and will return the value present just before the write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
__int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64( &dataAndCount, newDataAndCount, lastDataAndCount );
if( lastDataAndCount2 != lastDataAndCount )
{
@@ -576,7 +576,7 @@ int SparseDataStorage::compress()
{
// Success
queueForDelete( planeIndices );
// printf("Successfully compressed to %d planes, to delete 0x%x\n", planesToAlloc, planeIndices);
// printf("Successfully compressed to %d planes, to delete 0x%x\n", planesToAlloc, planeIndices);
#ifdef DATA_COMPRESSION_STATS
count = planesToAlloc;
#endif
@@ -617,9 +617,9 @@ void SparseDataStorage::read(DataInputStream *dis)
dis->readFully(wrapper);
#pragma warning ( disable : 4826 )
int64_t newDataAndCount = ((int64_t) dataPointer) & 0x0000ffffffffffffL;
__int64 newDataAndCount = ((__int64) dataPointer) & 0x0000ffffffffffffL;
#pragma warning ( default : 4826 )
newDataAndCount |= ((int64_t)count) << 48;
newDataAndCount |= ((__int64)count) << 48;
updateDataAndCount(newDataAndCount);
}