aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/BasicTypeContainers.h
blob: d2936ebebf9c4b779f74e62a0e5caca5e42111ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once


class Byte
{
public:
	static const char MAX_VALUE = CHAR_MAX;
	static const char MIN_VALUE = CHAR_MIN;
};

class Short
{
public:
	static const short MAX_VALUE = SHRT_MAX;
	static const short MIN_VALUE = SHRT_MIN;
};

class Integer
{
public:
	static const int MAX_VALUE = INT_MAX;
	static int parseInt(wstring &str, int radix = 10);
};

class Float
{
public:
	static const float MAX_VALUE;
	static int floatToIntBits( float value )
	{
		return *(int *)&value;
	}
	static int floatToRawIntBits( float value )
	{
		return *(int *)&value;
	}

	static float intBitsToFloat( int bits )
	{
		return *(float *)&bits;
	}

	static const float POSITIVE_INFINITY;
};

class Double
{
public:
	static const double MAX_VALUE;
	static const double MIN_NORMAL;

	static bool isNaN( double a ) {
#ifdef __PS3__
		return isnan(a);
#else
		return ( a != a );
#endif
	}
	static bool isInfinite( double a ) { return false; /*4J TODO*/ }

	static double longBitsToDouble( int64_t bits )
	{
		return *(double *)&bits;
	}

	static int64_t doubleToLongBits( double d )
	{
		return *(int64_t *)&d;
	}
};

// 4J Stu - The String class should only be used if we need to use the BaseClass::class type
// As such I have renamed it so that we don't confuse it with places where we should use std::string
class _String
{
};