コード例 #1
0
ファイル: time.c プロジェクト: Nekrofage/DoomRPi
int ggCurTime(struct timeval *tv) { 
	FILETIME ftim;

	GetSystemTimeAsFileTime(&ftim);

	(tv)->tv_sec =  (((LARGE_INTEGER *)(void *)(&ftim))->QuadPart
				- GG_UINT64_C(116444736000000000)) / 10000000;
	(tv)->tv_usec = (((LARGE_INTEGER *)(void *)(&ftim))->QuadPart
				% 10000000) / 10;

	return 0;
}
コード例 #2
0
ファイル: rand_util.cpp プロジェクト: noodle1983/putty-nd3.x
    double BitsToOpenEndedUnitInterval(uint64 bits)
    {
        // 为了提高精度, 生成位数尽量多的数字, 然后进行适当的幂运算得到[0, 1)区间
        // 的double数值. IEEE 754精度要求是53位.

        COMPILE_ASSERT(std::numeric_limits<double>::radix==2, otherwise_use_scalbn);
        static const int kBits = std::numeric_limits<double>::digits;
        uint64 random_bits = bits & ((GG_UINT64_C(1)<<kBits) - 1);
        double result = ldexp(static_cast<double>(random_bits), -1*kBits);
        DCHECK_GE(result, 0.0);
        DCHECK_LT(result, 1.0);
        return result;
    }
コード例 #3
0
int test_doubleword_store(void) {
  STORE_TEST_START(64, GG_UINT64_C(0xC0FEBEEFDEADBABE));
  STORE_RI_TEST("strd", addr + 1,               0);
  /* Thumb forces the immediate to be a multiple of 4. */
  STORE_RI_TEST("strd", addr - 3,               4);
  STORE_RI_TEST("strd", addr + 1 + sizeof(val), -sizeof(val));
# if !defined(__thumb__)
  /* Reg-reg ldrd doesn't exist in Thumb. */
  STORE_RR_TEST("strd", addr + 1,               zero);
  STORE_RR_TEST("strd", addr,                   one);
  STORE_RR_TEST("strd", addr + 1 + sizeof(val), minus_size);
#endif
  return success;
}
コード例 #4
0
  1236,
  1236,
  1238,
  1250,
  1254,
  1256,
  1257,
  1269,
  1270,
  1280,
  1284,
  1285,
  1287,
  1290,
  1291,
  1291,
  1294,
  1297,
  1385,
  1512,
  1520,
  1548,
  1570,
  1581,
  1628,
  1712,
  1770,
};

static const uint64 kHash = GG_UINT64_C(0xff715ce4e7e9267b);