27 static uint64_t getTimeMillis(boost::posix_time::ptime time);
30 static uint64_t currentTimeMillis();
36 static int32_t getNextSize(int32_t targetSize);
40 static int32_t getShrinkSize(int32_t currentSize, int32_t targetSize);
47 static int32_t bytesDifference(uint8_t* bytes1, int32_t len1, uint8_t* bytes2, int32_t len2);
49 template <
typename TYPE>
51 return type->hashCode();
54 template <
typename TYPE>
59 template <
typename ITER,
typename PRED>
60 static int32_t
hashCode(ITER first, ITER last, PRED pred) {
62 for (ITER hash = first; hash != last; ++hash) {
63 code = code * 31 + pred(*hash);
69 static int32_t hashCode(
const wchar_t* array, int32_t start, int32_t end);
72 static int32_t hashCode(
const uint8_t* array, int32_t start, int32_t end);
75 static int32_t hashCode(
bool value);
78 template <
typename SOURCE,
typename DEST>
79 static void arrayCopy(SOURCE source, int32_t sourceOffset, DEST dest, int32_t destOffset, int32_t length) {
80 std::copy(source + sourceOffset, source + sourceOffset + length, dest + destOffset);
84 template <
typename DEST,
typename FILL>
85 static void arrayFill(DEST dest, int32_t destFrom, int32_t destTo, FILL value) {
86 std::fill(dest + destFrom, dest + destTo, value);
91 static int32_t doubleToIntBits(
double value);
95 static int32_t doubleToRawIntBits(
double value);
99 static double intBitsToDouble(int32_t bits);
103 static int64_t doubleToLongBits(
double value);
107 static int64_t doubleToRawLongBits(
double value);
111 static double longBitsToDouble(int64_t bits);
114 static bool isInfinite(
double value);
117 static bool isNaN(
double value);
120 template <
typename TYPE>
122 return boost::dynamic_pointer_cast<TYPE>(object).
get() != NULL;
129 static int64_t unsignedShift(int64_t num, int64_t shift);
132 static int32_t unsignedShift(int32_t num, int32_t shift);