improved MinGW compatibility

This commit is contained in:
Cubitect 2018-07-04 17:28:27 +01:00
parent 0f45704bdf
commit caa0500708
6 changed files with 115 additions and 115 deletions

View File

@ -46,7 +46,7 @@ void *searchCompactBiomesThread(void *data)
for(i = 0; i < scnt; i++)
{
printf("%ld\n", seeds[i]);
printf("%"PRId64"\n", seeds[i]);
}
fflush(stdout);
}
@ -64,11 +64,11 @@ int main(int argc, char *argv[])
int64_t seedStart, seedEnd;
unsigned int threads, t;
if(argc <= 1 || sscanf(argv[1], "%ld", &seedStart) != 1) seedStart = 0;
if(argc <= 2 || sscanf(argv[2], "%ld", &seedEnd) != 1) seedEnd = 100000000L;
if(argc <= 1 || sscanf(argv[1], "%"PRId64, &seedStart) != 1) seedStart = 0;
if(argc <= 2 || sscanf(argv[2], "%"PRId64, &seedEnd) != 1) seedEnd = 100000000LL;
if(argc <= 3 || sscanf(argv[3], "%u", &threads) != 1) threads = 1;
printf("Starting search through seeds %ld to %ld, using %u threads.\n", seedStart, seedEnd, threads);
printf("Starting search through seeds %"PRId64 " to %"PRId64", using %u threads.\n", seedStart, seedEnd, threads);
pthread_t threadID[threads];
struct compactinfo_t info[threads];

View File

@ -182,7 +182,7 @@ int main(int argc, char *argv[])
if(getBiomeAtPos(g, qhpos[2]) != swampland) continue;
if(getBiomeAtPos(g, qhpos[3]) != swampland) continue;
printf("%ld\n", seed);
printf("%"PRId64 "\n", seed);
hits++;
}
}

162
finders.c
View File

@ -61,8 +61,6 @@ Biome biomes[256];
*/
#define SEEDMAX (1L << 48)
typedef struct quad_threadinfo_t
{
@ -115,27 +113,27 @@ int isQuadFeatureBase(const int64_t structureSeed, const int64_t seed,
int64_t s;
s = (reg00base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 < upper) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 < upper) return 0;
s = (reg01base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 > lower) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 < upper) return 0;
s = (reg10base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 < upper) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 > lower) return 0;
s = (reg11base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 > lower) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 > lower) return 0;
return 1;
@ -155,35 +153,35 @@ int isTriFeatureBase(const int64_t structureSeed, const int64_t seed,
int missing = 0;
s = (reg00base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 < upper ||
(((s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff) >> 17) % 24 < upper)
(((s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff) >> 17) % 24 < upper)
{
missing++;
}
s = (reg01base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 > lower ||
(((s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff) >> 17) % 24 < upper)
(((s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff) >> 17) % 24 < upper)
{
if(missing) return 0;
missing++;
}
s = (reg10base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 < upper ||
(((s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff) >> 17) % 24 > lower)
(((s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff) >> 17) % 24 > lower)
{
if(missing) return 0;
missing++;
}
s = (reg11base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
if((s >> 17) % 24 > lower ||
(((s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff) >> 17) % 24 > lower)
(((s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff) >> 17) % 24 > lower)
{
if(missing) return 0;
}
@ -209,72 +207,72 @@ int isQuadMonumentBase(const int64_t seed, const int qual)
/*
seed = regionX*341873128712 + regionZ*132897987541 + seed + 10387313;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed ^ 0x5DEECE66DLL);// & ((1LL << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x += (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z += (seed >> 17) % 27;
*/
s = (reg00base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (reg01base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (reg10base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
s = (reg11base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
@ -295,30 +293,30 @@ int isTriMonumentBase(const int64_t seed, const int qual)
/*
seed = regionX*341873128712 + regionZ*132897987541 + seed + 10387313;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed ^ 0x5DEECE66DLL);// & ((1LL << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x += (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z += (seed >> 17) % 27;
*/
s = (reg00base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp11;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp11;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp11;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp11;
@ -329,16 +327,16 @@ int isTriMonumentBase(const int64_t seed, const int qual)
}
s = (reg01base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp01;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp01;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp01;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp01;
@ -350,16 +348,16 @@ int isTriMonumentBase(const int64_t seed, const int qual)
}
s = (reg10base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp10;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp10;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp10;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp10;
@ -371,16 +369,16 @@ int isTriMonumentBase(const int64_t seed, const int qual)
}
s = (reg11base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp00;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp00;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp00;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
s = (s * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp00;
@ -471,7 +469,7 @@ int64_t *loadSavedSeeds(const char *fnam, int64_t *scnt)
while(!feof(fp))
{
if(fscanf(fp, "%ld", &seed) == 1) (*scnt)++;
if(fscanf(fp, "%"PRId64, &seed) == 1) (*scnt)++;
else while(!feof(fp) && fgetc(fp) != '\n');
}
@ -481,7 +479,7 @@ int64_t *loadSavedSeeds(const char *fnam, int64_t *scnt)
for(int64_t i = 0; i < *scnt && !feof(fp);)
{
if(fscanf(fp, "%ld", &baseSeeds[i]) == 1) i++;
if(fscanf(fp, "%"PRId64, &baseSeeds[i]) == 1) i++;
else while(!feof(fp) && fgetc(fp) != '\n');
}
@ -557,14 +555,14 @@ static void *search4QuadBasesThread(void *data)
{
char *last_newline = strrchr(buf, '\n');
if(sscanf(last_newline, "%ld", &seed) == 1)
if(sscanf(last_newline, "%"PRId64, &seed) == 1)
{
while(lowerBits[lowerBitsIdx] <= (seed & 0xffff))
lowerBitsIdx++;
seed = (seed & 0x0000ffffffff0000) + lowerBits[lowerBitsIdx];
printf("Thread %d starting from: %ld\n", info.threadID, seed);
printf("Thread %d starting from: %"PRId64"\n", info.threadID, seed);
}
else
{
@ -581,9 +579,9 @@ static void *search4QuadBasesThread(void *data)
{
if(isQuadFeatureBase(structureSeed, seed, lower, upper))
{
fprintf(fp, "%ld\n", seed);
fprintf(fp, "%"PRId64"\n", seed);
fflush(fp);
//printf("Thread %d: %ld\n", info.threadID, seed);
//printf("Thread %d: %"PRId64"\n", info.threadID, seed);
}
lowerBitsIdx++;
@ -706,12 +704,12 @@ Pos getStructurePos(const int64_t structureSeed, int64_t seed,
// set seed
seed = regionX*341873128712 + regionZ*132897987541 + seed + structureSeed;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed ^ 0x5DEECE66DLL);// & ((1LL << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x = (seed >> 17) % 24;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z = (seed >> 17) % 24;
pos.x = regionX*512 + (pos.x << 4) + 8;
@ -742,12 +740,12 @@ Pos getStructureChunkInRegion(const int64_t structureSeed, int64_t seed,
// set seed
seed = regionX*341873128712 + regionZ*132897987541 + seed + structureSeed;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed ^ 0x5DEECE66DLL);// & ((1LL << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x = (seed >> 17) % 24;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z = (seed >> 17) % 24;
return pos;
@ -766,16 +764,16 @@ Pos getOceanMonumentPos(int64_t seed, const int64_t regionX, const int64_t regio
// set seed
seed = regionX*341873128712 + regionZ*132897987541 + seed + MONUMENT_SEED;
seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1);
seed = (seed ^ 0x5DEECE66DLL) & ((1LL << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x += (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z += (seed >> 17) % 27;
pos.x = regionX*32 + (pos.x >> 1);
@ -799,16 +797,16 @@ Pos getMansionPos(int64_t seed, const int64_t area80X, const int64_t area80Z)
// set seed
seed = area80X*341873128712 + area80Z*132897987541 + seed + MANSION_SEED;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed ^ 0x5DEECE66DLL);// & ((1LL << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x = (seed >> 17) % 60;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.x += (seed >> 17) % 60;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z = (seed >> 17) % 60;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
seed = (seed * 0x5DEECE66DLL + 0xBLL) & 0xffffffffffff;
pos.z += (seed >> 17) % 60;
pos.x = area80X*80 + (pos.x >> 1);

View File

@ -9,7 +9,7 @@
#define THREADS 6
#define SEEDMAX (1L << 48)
#define SEEDMAX (1LL << 48)
#define FEATURE_SEED 14357617
#define VILLAGE_SEED 10387312
@ -366,12 +366,12 @@ int64_t filterAllMajorBiomes(
static inline void setSeed(int64_t *seed)
{
*seed = (*seed ^ 0x5DEECE66DL) & ((1L << 48) - 1);
*seed = (*seed ^ 0x5DEECE66DLL) & ((1LL << 48) - 1);
}
static inline int next(int64_t *seed, const int bits)
{
*seed = (*seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
*seed = (*seed * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
return (int) (*seed >> (48 - bits));
}
@ -398,7 +398,7 @@ static inline float nextFloat(int64_t *seed)
static inline double nextDouble(int64_t *seed)
{
return (((int64_t) next(seed, 26) << 27) + next(seed, 27)) / (double) (1L << 53);
return (((int64_t) next(seed, 26) << 27) + next(seed, 27)) / (double) (1LL << 53);
}
@ -431,13 +431,13 @@ static inline int secondInt24(int64_t seed)
static inline int64_t invSeed48(int64_t nseed)
{
const int64_t x = 0x5deece66d;
const int64_t xinv = 0xdfe05bcb1365L;
const int64_t y = 0xbL;
const int64_t m48 = 0xffffffffffffL;
const int64_t xinv = 0xdfe05bcb1365LL;
const int64_t y = 0xbLL;
const int64_t m48 = 0xffffffffffffLL;
int64_t a = nseed >> 32;
int64_t b = nseed & 0xffffffffL;
if(b & 0x80000000L) a++;
int64_t b = nseed & 0xffffffffLL;
if(b & 0x80000000LL) a++;
int64_t q = ((b << 16) - y - (a << 16)*x) & m48;
for(int64_t k = 0; k <= 5; k++)

View File

@ -116,11 +116,11 @@ void setWorldSeed(Layer *layer, int64_t seed)
setWorldSeed(layer->p, seed);
layer->worldSeed = seed;
layer->worldSeed *= layer->worldSeed * 6364136223846793005L + 1442695040888963407L;
layer->worldSeed *= layer->worldSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->worldSeed += layer->baseSeed;
layer->worldSeed *= layer->worldSeed * 6364136223846793005L + 1442695040888963407L;
layer->worldSeed *= layer->worldSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->worldSeed += layer->baseSeed;
layer->worldSeed *= layer->worldSeed * 6364136223846793005L + 1442695040888963407L;
layer->worldSeed *= layer->worldSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->worldSeed += layer->baseSeed;
}
@ -135,7 +135,7 @@ void mapIsland(Layer *l, int * __restrict out, int areaX, int areaZ, int areaWid
register int x, z;
const int64_t ws = l->worldSeed;
const int64_t ss = ws * (ws * 6364136223846793005L + 1442695040888963407L);
const int64_t ss = ws * (ws * 6364136223846793005LL + 1442695040888963407LL);
for(z = 0; z < areaHeight; z++)
{
@ -145,11 +145,11 @@ void mapIsland(Layer *l, int * __restrict out, int areaX, int areaZ, int areaWid
const int64_t chunkZ = (int64_t)(z + areaZ);
register int64_t cs = ss;
cs += chunkX;
cs *= cs * 6364136223846793005L + 1442695040888963407L;
cs *= cs * 6364136223846793005LL + 1442695040888963407LL;
cs += chunkZ;
cs *= cs * 6364136223846793005L + 1442695040888963407L;
cs *= cs * 6364136223846793005LL + 1442695040888963407LL;
cs += chunkX;
cs *= cs * 6364136223846793005L + 1442695040888963407L;
cs *= cs * 6364136223846793005LL + 1442695040888963407LL;
cs += chunkZ;
out[x + z*areaWidth] = (cs >> 24) % 10 == 0;
@ -384,7 +384,7 @@ void mapAddIsland(Layer *l, int * __restrict out, int areaX, int areaZ, int area
l->p->getMap(l->p, out, pX, pZ, pWidth, pHeight);
const int64_t ws = l->worldSeed;
const int64_t ss = ws * (ws * 6364136223846793005L + 1442695040888963407L);
const int64_t ss = ws * (ws * 6364136223846793005LL + 1442695040888963407LL);
for(z = 0; z < areaHeight; z++)
{
@ -425,11 +425,11 @@ void mapAddIsland(Layer *l, int * __restrict out, int areaX, int areaZ, int area
register int64_t cs = ss;
cs += chunkX;
cs *= cs * 6364136223846793005L + 1442695040888963407L;
cs *= cs * 6364136223846793005LL + 1442695040888963407LL;
cs += chunkZ;
cs *= cs * 6364136223846793005L + 1442695040888963407L;
cs *= cs * 6364136223846793005LL + 1442695040888963407LL;
cs += chunkX;
cs *= cs * 6364136223846793005L + 1442695040888963407L;
cs *= cs * 6364136223846793005LL + 1442695040888963407LL;
cs += chunkZ;
if((cs >> 24) % 5 == 0)

View File

@ -3,6 +3,8 @@
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#if defined USE_SIMD && __AVX2__
#include <emmintrin.h>
@ -153,7 +155,7 @@ static inline int mcNextInt(Layer *layer, int mod)
ret += mod;
}
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005L + 1442695040888963407L;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->chunkSeed += layer->worldSeed;
return ret;
}
@ -161,24 +163,24 @@ static inline int mcNextInt(Layer *layer, int mod)
static inline void setChunkSeed(Layer *layer, int64_t chunkX, int64_t chunkZ)
{
layer->chunkSeed = layer->worldSeed;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005L + 1442695040888963407L;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->chunkSeed += chunkX;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005L + 1442695040888963407L;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->chunkSeed += chunkZ;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005L + 1442695040888963407L;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->chunkSeed += chunkX;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005L + 1442695040888963407L;
layer->chunkSeed *= layer->chunkSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->chunkSeed += chunkZ;
}
static inline void setBaseSeed(Layer *layer, int64_t seed)
{
layer->baseSeed = seed;
layer->baseSeed *= layer->baseSeed * 6364136223846793005L + 1442695040888963407L;
layer->baseSeed *= layer->baseSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->baseSeed += seed;
layer->baseSeed *= layer->baseSeed * 6364136223846793005L + 1442695040888963407L;
layer->baseSeed *= layer->baseSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->baseSeed += seed;
layer->baseSeed *= layer->baseSeed * 6364136223846793005L + 1442695040888963407L;
layer->baseSeed *= layer->baseSeed * 6364136223846793005LL + 1442695040888963407LL;
layer->baseSeed += seed;
layer->p = NULL;