missed some

This commit is contained in:
Tropical 2026-03-21 17:12:22 -05:00
parent 357fca24aa
commit e7bafb17d0
7 changed files with 54 additions and 54 deletions

View file

@ -158,7 +158,7 @@ RegionFile::~RegionFile() {
m_saveFile->closeHandle(fileEntry);
}
__int64 RegionFile::lastModified() { return _lastModified; }
int64_t RegionFile::lastModified() { return _lastModified; }
int RegionFile::getSizeDelta() // TODO - was synchronized
{

View file

@ -50,7 +50,7 @@ SparseDataStorage::SparseDataStorage() {
// planes allocated - 127 planes allocated in this case
dataAndCount =
0x007F000000000000L | (((__int64)planeIndices) & 0x0000ffffffffffffL);
0x007F000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
#ifdef DATA_COMPRESSION_STATS
count = 128;
@ -72,7 +72,7 @@ SparseDataStorage::SparseDataStorage(bool isUpper) {
// planes allocated - 127 planes allocated in this case
dataAndCount =
0x0000000000000000L | (((__int64)planeIndices) & 0x0000ffffffffffffL);
0x0000000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
#ifdef DATA_COMPRESSION_STATS
count = 128;
@ -98,7 +98,7 @@ SparseDataStorage::~SparseDataStorage() {
SparseDataStorage::SparseDataStorage(SparseDataStorage* copyFrom) {
// Extra details of source storage
__int64 sourceDataAndCount = copyFrom->dataAndCount;
int64_t sourceDataAndCount = copyFrom->dataAndCount;
unsigned char* sourceIndicesAndData =
(unsigned char*)(sourceDataAndCount & 0x0000ffffffffffff);
int sourceCount = (sourceDataAndCount >> 48) & 0xffff;
@ -114,7 +114,7 @@ SparseDataStorage::SparseDataStorage(SparseDataStorage* copyFrom) {
// fixes it for now.
dataAndCount = (sourceDataAndCount & 0xffff000000000000L) |
(((__int64)destIndicesAndData) & 0x0000ffffffffffffL);
(((int64_t)destIndicesAndData) & 0x0000ffffffffffffL);
XMemCpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128);
@ -194,9 +194,9 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) {
// Get new data and count packed info
__int64 newDataAndCount = ((__int64)planeIndices) & 0x0000ffffffffffffL;
int64_t newDataAndCount = ((int64_t)planeIndices) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)allocatedPlaneCount) << 48;
newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48;
updateDataAndCount(newDataAndCount);
}
@ -391,7 +391,7 @@ void SparseDataStorage::addNewPlane(int y) {
bool success = false;
do {
// Get last packed data pointer & count
__int64 lastDataAndCount = dataAndCount;
int64_t lastDataAndCount = dataAndCount;
// Unpack count & data pointer
int lastLinesUsed = (int)((lastDataAndCount >> 48) & 0xffff);
@ -416,15 +416,15 @@ void SparseDataStorage::addNewPlane(int y) {
// Get new data and count packed info
__int64 newDataAndCount = ((__int64)dataPointer) & 0x0000ffffffffffffL;
int64_t newDataAndCount = ((int64_t)dataPointer) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)linesUsed) << 48;
newDataAndCount |= ((int64_t)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 lastDataAndCount2 = InterlockedCompareExchangeRelease64(
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
@ -489,13 +489,13 @@ void SparseDataStorage::tick() {
// Update storage with a new values for dataAndCount, repeating as necessary if
// other simultaneous writes happen.
void SparseDataStorage::updateDataAndCount(__int64 newDataAndCount) {
void SparseDataStorage::updateDataAndCount(int64_t 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 lastDataAndCount = dataAndCount;
int64_t lastDataAndCount = dataAndCount;
unsigned char* lastDataPointer =
(unsigned char*)(lastDataAndCount & 0x0000ffffffffffff);
@ -503,7 +503,7 @@ void SparseDataStorage::updateDataAndCount(__int64 newDataAndCount) {
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
__int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64(
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
@ -527,7 +527,7 @@ int SparseDataStorage::compress() {
unsigned char _planeIndices[128];
bool needsCompressed = false;
__int64 lastDataAndCount = dataAndCount;
int64_t lastDataAndCount = dataAndCount;
unsigned char* planeIndices =
(unsigned char*)(lastDataAndCount & 0x0000ffffffffffff);
@ -569,16 +569,16 @@ int SparseDataStorage::compress() {
// Get new data and count packed info
__int64 newDataAndCount =
((__int64)newIndicesAndData) & 0x0000ffffffffffffL;
int64_t newDataAndCount =
((int64_t)newIndicesAndData) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)planesToAlloc) << 48;
newDataAndCount |= ((int64_t)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 lastDataAndCount2 = InterlockedCompareExchangeRelease64(
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 != lastDataAndCount) {
@ -623,9 +623,9 @@ void SparseDataStorage::read(DataInputStream* dis) {
byteArray wrapper(dataPointer, count * 128 + 128);
dis->readFully(wrapper);
__int64 newDataAndCount = ((__int64)dataPointer) & 0x0000ffffffffffffL;
int64_t newDataAndCount = ((int64_t)dataPointer) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)count) << 48;
newDataAndCount |= ((int64_t)count) << 48;
updateDataAndCount(newDataAndCount);
}

View file

@ -30,13 +30,13 @@
// system, implemented using a read-copy-update (RCU) type algorithm. Some
// details...
// (1) The storage details for the class are now packed into a single __int64,
// (1) The storage details for the class are now packed into a single int64_t,
// which contains both a pointer to the data that is required and a count of how
// many planes worth
// of storage are allocated. This allows the full storage to be updated
// atomically using compare and exchange operations (implemented with
// InterlockedCompareExchangeRelease64).
// (2) The data pointer referenced in this __int64 points to an area of memory
// (2) The data pointer referenced in this int64_t points to an area of memory
// which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere
// the plane indices, and
// the rest of the data is variable in size to accomodate however many
@ -62,7 +62,7 @@ class SparseDataStorage {
private:
// unsigned char planeIndices[128];
__int64 dataAndCount; // Contains packed-together data pointer (lower
int64_t dataAndCount; // Contains packed-together data pointer (lower
// 48-bits), and count of lines used (upper 16-bits)
// unsigned char *data;
@ -109,7 +109,7 @@ public:
void addNewPlane(int y);
void getPlaneIndicesAndData(unsigned char** planeIndices,
unsigned char** data);
void updateDataAndCount(__int64 newDataAndCount);
void updateDataAndCount(int64_t newDataAndCount);
int compress();
bool isCompressed();

View file

@ -51,7 +51,7 @@ SparseLightStorage::SparseLightStorage(bool sky) {
// planes allocated - 127 planes allocated in this case
dataAndCount =
0x007F000000000000L | (((__int64)planeIndices) & 0x0000ffffffffffffL);
0x007F000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
#ifdef LIGHT_COMPRESSION_STATS
count = 127;
@ -73,7 +73,7 @@ SparseLightStorage::SparseLightStorage(bool sky, bool isUpper) {
// planes allocated - 0 planes allocated in this case
dataAndCount =
0x0000000000000000L | (((__int64)planeIndices) & 0x0000ffffffffffffL);
0x0000000000000000L | (((int64_t)planeIndices) & 0x0000ffffffffffffL);
#ifdef LIGHT_COMPRESSION_STATS
count = 0;
@ -99,7 +99,7 @@ SparseLightStorage::~SparseLightStorage() {
SparseLightStorage::SparseLightStorage(SparseLightStorage* copyFrom) {
// Extra details of source storage
__int64 sourceDataAndCount = copyFrom->dataAndCount;
int64_t sourceDataAndCount = copyFrom->dataAndCount;
unsigned char* sourceIndicesAndData =
(unsigned char*)(sourceDataAndCount & 0x0000ffffffffffff);
int sourceCount = (sourceDataAndCount >> 48) & 0xffff;
@ -115,7 +115,7 @@ SparseLightStorage::SparseLightStorage(SparseLightStorage* copyFrom) {
// fixes it for now.
dataAndCount = (sourceDataAndCount & 0xffff000000000000L) |
(((__int64)destIndicesAndData) & 0x0000ffffffffffffL);
(((int64_t)destIndicesAndData) & 0x0000ffffffffffffL);
XMemCpy(destIndicesAndData, sourceIndicesAndData, sourceCount * 128 + 128);
@ -196,9 +196,9 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset) {
// Get new data and count packed info
__int64 newDataAndCount = ((__int64)planeIndices) & 0x0000ffffffffffffL;
int64_t newDataAndCount = ((int64_t)planeIndices) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)allocatedPlaneCount) << 48;
newDataAndCount |= ((int64_t)allocatedPlaneCount) << 48;
updateDataAndCount(newDataAndCount);
}
@ -319,7 +319,7 @@ void SparseLightStorage::setAllBright() {
// Data and count packs together the pointer to our data and the count of
// planes allocated, which is currently zero
__int64 newDataAndCount = ((__int64)planeIndices) & 0x0000ffffffffffffL;
int64_t newDataAndCount = ((int64_t)planeIndices) & 0x0000ffffffffffffL;
updateDataAndCount(newDataAndCount);
}
@ -392,7 +392,7 @@ void SparseLightStorage::addNewPlane(int y) {
bool success = false;
do {
// Get last packed data pointer & count
__int64 lastDataAndCount = dataAndCount;
int64_t lastDataAndCount = dataAndCount;
// Unpack count & data pointer
int lastLinesUsed = (int)((lastDataAndCount >> 48) & 0xffff);
@ -419,15 +419,15 @@ void SparseLightStorage::addNewPlane(int y) {
// Get new data and count packed info
__int64 newDataAndCount = ((__int64)dataPointer) & 0x0000ffffffffffffL;
int64_t newDataAndCount = ((int64_t)dataPointer) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)linesUsed) << 48;
newDataAndCount |= ((int64_t)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 lastDataAndCount2 = InterlockedCompareExchangeRelease64(
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
@ -492,13 +492,13 @@ void SparseLightStorage::tick() {
// Update storage with a new values for dataAndCount, repeating as necessary if
// other simultaneous writes happen.
void SparseLightStorage::updateDataAndCount(__int64 newDataAndCount) {
void SparseLightStorage::updateDataAndCount(int64_t 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 lastDataAndCount = dataAndCount;
int64_t lastDataAndCount = dataAndCount;
unsigned char* lastDataPointer =
(unsigned char*)(lastDataAndCount & 0x0000ffffffffffff);
@ -506,7 +506,7 @@ void SparseLightStorage::updateDataAndCount(__int64 newDataAndCount) {
// succeed if the data stored at dataAndCount is equal to
// lastDataAndCount, and will return the value present just before the
// write took place
__int64 lastDataAndCount2 = InterlockedCompareExchangeRelease64(
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
@ -530,7 +530,7 @@ int SparseLightStorage::compress() {
unsigned char _planeIndices[128];
bool needsCompressed = false;
__int64 lastDataAndCount = dataAndCount;
int64_t lastDataAndCount = dataAndCount;
unsigned char* planeIndices =
(unsigned char*)(lastDataAndCount & 0x0000ffffffffffff);
@ -579,16 +579,16 @@ int SparseLightStorage::compress() {
// Get new data and count packed info
__int64 newDataAndCount =
((__int64)newIndicesAndData) & 0x0000ffffffffffffL;
int64_t newDataAndCount =
((int64_t)newIndicesAndData) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)planesToAlloc) << 48;
newDataAndCount |= ((int64_t)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 lastDataAndCount2 = InterlockedCompareExchangeRelease64(
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 != lastDataAndCount) {
@ -633,9 +633,9 @@ void SparseLightStorage::read(DataInputStream* dis) {
byteArray wrapper(dataPointer, count * 128 + 128);
dis->readFully(wrapper);
__int64 newDataAndCount = ((__int64)dataPointer) & 0x0000ffffffffffffL;
int64_t newDataAndCount = ((int64_t)dataPointer) & 0x0000ffffffffffffL;
newDataAndCount |= ((__int64)count) << 48;
newDataAndCount |= ((int64_t)count) << 48;
updateDataAndCount(newDataAndCount);
}

View file

@ -32,13 +32,13 @@
// system, implemented using a read-copy-update (RCU) type algorithm. Some
// details...
// (1) The storage details for the class are now packed into a single __int64,
// (1) The storage details for the class are now packed into a single int64_t,
// which contains both a pointer to the data that is required and a count of how
// many planes worth
// of storage are allocated. This allows the full storage to be updated
// atomically using compare and exchange operations (implemented with
// InterlockedCompareExchangeRelease64).
// (2) The data pointer referenced in this __int64 points to an area of memory
// (2) The data pointer referenced in this int64_t points to an area of memory
// which is 128 + 128 * plane_count bytes long, where the first 128 bytes stoere
// the plane indices, and
// the rest of the data is variable in size to accomodate however many
@ -64,7 +64,7 @@ class SparseLightStorage {
private:
// unsigned char planeIndices[128];
__int64 dataAndCount; // Contains packed-together data pointer (lower
int64_t dataAndCount; // Contains packed-together data pointer (lower
// 48-bits), and count of lines used (upper 16-bits)
// unsigned char *data;
@ -109,7 +109,7 @@ public:
void addNewPlane(int y);
void getPlaneIndicesAndData(unsigned char** planeIndices,
unsigned char** data);
void updateDataAndCount(__int64 newDataAndCount);
void updateDataAndCount(int64_t newDataAndCount);
int compress();
bool isCompressed();

View file

@ -24,7 +24,7 @@ std::FILE* OpenBinaryFileForReadWrite(const File& file) {
const int ZoneFile::slotsLength =
ZonedChunkStorage::CHUNKS_PER_ZONE * ZonedChunkStorage::CHUNKS_PER_ZONE;
ZoneFile::ZoneFile(__int64 key, File file, File entityFile)
ZoneFile::ZoneFile(int64_t key, File file, File entityFile)
: slots(slotsLength) {
lastUse = 0;

View file

@ -18,18 +18,18 @@ private:
short slotCount;
public:
__int64 lastUse;
int64_t lastUse;
private:
std::FILE* channel;
public:
__int64 key;
int64_t key;
File file;
NbtSlotFile* entityFile;
ZoneFile(__int64 key, File file, File entityFile);
ZoneFile(int64_t key, File file, File entityFile);
~ZoneFile();
void readHeader();