mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[common] time: improve flow with compiler hints
This commit is contained in:
parent
d3ee5bddde
commit
4911e129f8
@ -23,6 +23,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "common/util.h"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -40,7 +41,7 @@ static inline uint64_t microtime(void)
|
|||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
static unsigned long div = 0;
|
static unsigned long div = 0;
|
||||||
if (div == 0)
|
if (unlikely(div == 0))
|
||||||
{
|
{
|
||||||
LARGE_INTEGER freq = { .QuadPart = 0LL };
|
LARGE_INTEGER freq = { .QuadPart = 0LL };
|
||||||
QueryPerformanceFrequency(&freq);
|
QueryPerformanceFrequency(&freq);
|
||||||
@ -78,7 +79,7 @@ static inline uint64_t nanotime(void)
|
|||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
static double multiplier = 0.0;
|
static double multiplier = 0.0;
|
||||||
if (!multiplier)
|
if (unlikely(!multiplier))
|
||||||
{
|
{
|
||||||
LARGE_INTEGER freq = { .QuadPart = 0LL };
|
LARGE_INTEGER freq = { .QuadPart = 0LL };
|
||||||
QueryPerformanceFrequency(&freq);
|
QueryPerformanceFrequency(&freq);
|
||||||
|
Loading…
Reference in New Issue
Block a user