aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Random.cpp
diff options
context:
space:
mode:
authorvoid_17 <heroerror3@gmail.com>2026-03-02 17:39:35 +0700
committervoid_17 <heroerror3@gmail.com>2026-03-02 17:39:35 +0700
commitb9a2951901dac21b08589c9d8b4a7eae78757726 (patch)
tree6b750cbdde9d2bd2aeaec9880ac7db62e9356745 /Minecraft.World/Random.cpp
parent119bff351450ea16ffda550b6e0f67379b29f708 (diff)
Revert "Get rid of MSVC's __int64"
This reverts commit d63f79325f85e014361eb8cf1e41eaebedb1ae71.
Diffstat (limited to 'Minecraft.World/Random.cpp')
-rw-r--r--Minecraft.World/Random.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Minecraft.World/Random.cpp b/Minecraft.World/Random.cpp
index d4e3a545..9176bf38 100644
--- a/Minecraft.World/Random.cpp
+++ b/Minecraft.World/Random.cpp
@@ -1,4 +1,4 @@
-#include "stdafx.h"
+#include "stdafx.h"
#include "Random.h"
#include "System.h"
@@ -6,19 +6,19 @@ Random::Random()
{
// 4J - jave now uses the system nanosecond counter added to a "seedUniquifier" to get an initial seed. Our nanosecond timer is actually only millisecond accuate, so
// use QueryPerformanceCounter here instead
- int64_t seed;
+ __int64 seed;
QueryPerformanceCounter((LARGE_INTEGER *)&seed);
seed += 8682522807148012LL;
setSeed(seed);
}
-Random::Random(int64_t seed)
+Random::Random(__int64 seed)
{
setSeed(seed);
}
-void Random::setSeed(int64_t s)
+void Random::setSeed(__int64 s)
{
this->seed = (s ^ 0x5DEECE66DLL) & ((1LL << 48) - 1);
haveNextNextGaussian = false;
@@ -41,7 +41,7 @@ void Random::nextBytes(byte *bytes, unsigned int count)
double Random::nextDouble()
{
- return (((int64_t)next(26) << 27) + next(27))
+ return (((__int64)next(26) << 27) + next(27))
/ (double)(1LL << 53);
}
@@ -56,7 +56,7 @@ double Random::nextGaussian()
{
double v1, v2, s;
do
- {
+ {
v1 = 2 * nextDouble() - 1; // between -1.0 and 1.0
v2 = 2 * nextDouble() - 1; // between -1.0 and 1.0
s = v1 * v1 + v2 * v2;
@@ -79,7 +79,7 @@ int Random::nextInt(int n)
if ((n & -n) == n) // i.e., n is a power of 2
- return (int)(((int64_t)next(31) * n) >> 31); // 4J Stu - Made int64_t instead of long
+ return (int)(((__int64)next(31) * n) >> 31); // 4J Stu - Made __int64 instead of long
int bits, val;
do
@@ -95,9 +95,9 @@ float Random::nextFloat()
return next(24) / ((float)(1 << 24));
}
-int64_t Random::nextLong()
+__int64 Random::nextLong()
{
- return ((int64_t)next(32) << 32) + next(32);
+ return ((__int64)next(32) << 32) + next(32);
}
bool Random::nextBoolean()