mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 13:52:57 +00:00
[common] time: improve flow with compiler hints
This commit is contained in:
parent
d3ee5bddde
commit
4911e129f8
1 changed files with 3 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include "common/util.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
|
@ -40,7 +41,7 @@ static inline uint64_t microtime(void)
|
|||
{
|
||||
#if defined(_WIN32)
|
||||
static unsigned long div = 0;
|
||||
if (div == 0)
|
||||
if (unlikely(div == 0))
|
||||
{
|
||||
LARGE_INTEGER freq = { .QuadPart = 0LL };
|
||||
QueryPerformanceFrequency(&freq);
|
||||
|
@ -78,7 +79,7 @@ static inline uint64_t nanotime(void)
|
|||
{
|
||||
#if defined(_WIN32)
|
||||
static double multiplier = 0.0;
|
||||
if (!multiplier)
|
||||
if (unlikely(!multiplier))
|
||||
{
|
||||
LARGE_INTEGER freq = { .QuadPart = 0LL };
|
||||
QueryPerformanceFrequency(&freq);
|
||||
|
|
Loading…
Reference in a new issue