18 #ifndef _DECAF_LANG_INTEGER_H_
19 #define _DECAF_LANG_INTEGER_H_
41 static const int SIZE = 32;
44 static const int MAX_VALUE = (int)0x7FFFFFFF;
47 static const int MIN_VALUE = (int)0x80000000;
67 Integer(
const std::string& value );
79 virtual int compareTo(
const Integer& i )
const;
86 return this->value == i.value;
95 return this->value == i.value;
105 return this->value < i.value;
116 virtual int compareTo(
const int& i )
const;
123 return this->value == i;
132 return this->value == i;
142 return this->value < i;
148 std::string toString()
const;
155 return (
double)this->value;
163 return (
float)this->value;
171 return (
unsigned char)this->value;
179 return (
short)this->value;
195 return (
long long)this->value;
215 static Integer decode(
const std::string& value );
223 static int reverseBytes(
int value );
231 static int reverse(
int value );
256 static int parseInt(
const std::string& s,
int radix );
269 static int parseInt(
const std::string& s );
290 static Integer valueOf(
const std::string& value );
304 static Integer valueOf(
const std::string& value,
int radix );
314 static int bitCount(
int value );
322 static std::string toString(
int value );
347 static std::string toString(
int value,
int radix );
368 static std::string toHexString(
int value );
388 static std::string toOctalString(
int value );
407 static std::string toBinaryString(
int value );
419 static int highestOneBit(
int value );
431 static int lowestOneBit(
int value );
450 static int numberOfLeadingZeros(
int value );
462 static int numberOfTrailingZeros(
int value );
481 static int rotateLeft(
int value,
int distance );
500 static int rotateRight(
int value,
int distance );
509 static int signum(
int value );
513 static int parse(
const std::string& value,
int offset,
514 int radix,
bool negative );