Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Compare Revisions
f0a83672aa0c8d0d638bfd623daeffa91da40784...f8da2a2f2ff8668017906f4871f80f3fdf65988b
Commits (1)
More Win32 optimizations.
· f8da2a2f
Deucе
authored
Feb 12, 2022
f8da2a2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
src/xpdev/genwrap.c
src/xpdev/genwrap.c
+22
-7
No files found.
src/xpdev/genwrap.c
View file @
f8da2a2f
...
...
@@ -842,20 +842,35 @@ uint64_t xp_timer64(void)
else
ret
=
-
1
;
#elif defined(_WIN32)
static
BOOL
can_use_QPF
=
TRUE
;
static
BOOL
intable
=
FALSE
;
static
BOOL
intable_tested
=
FALSE
;
LARGE_INTEGER
freq
;
static
BOOL
initialized
=
FALSE
;
static
uint32_t
msfreq
;
static
double
msdfreq
;
LARGE_INTEGER
tick
;
if
(
QueryPerformanceFrequency
(
&
freq
)
&&
QueryPerformanceCounter
(
&
tick
))
{
if
(
!
intable_tested
)
{
if
(
!
initialized
)
{
if
(
!
QueryPerformanceFrequency
(
&
freq
))
can_use_QPF
=
FALSE
;
else
intable
=
(
freq
.
QuadPart
%
1000
)
==
0
;
intable_tested
=
TRUE
;
if
(
intable
)
msfreq
=
freq
.
QuadPart
/
1000
;
else
msdfreq
=
((
double
)
freq
.
QuadPart
)
/
1000
;
initialized
=
TRUE
;
}
if
(
can_use_QPF
)
{
if
(
!
QueryPerformanceCounter
(
&
tick
))
{
can_use_QPF
=
FALSE
;
return
GetTickCount
();
}
if
(
intable
)
ret
=
tick
.
QuadPart
/
(
freq
.
QuadPart
/
1000
)
;
ret
=
tick
.
QuadPart
/
ms
freq
;
else
ret
=
(
uint64_t
)(
((
double
)
tick
.
QuadPart
)
/
(((
double
)
freq
.
QuadPart
)
/
1000
))
;
ret
=
((
double
)
tick
.
QuadPart
)
/
msdfreq
;
}
else
{
ret
=
GetTickCount
();
...
...