mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-23 22:27:09 +00:00
missed some
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user