Skip to content

Commit 992096c

Browse files
committed
xrCore/math.h|cpp: cleanup
xrCore/Threading/Event.hpp|cpp: cleanup
1 parent 6cee0e7 commit 992096c

File tree

4 files changed

+6
-38
lines changed

4 files changed

+6
-38
lines changed

src/xrCore/Threading/Event.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "stdafx.h"
22
#include "Event.hpp"
3-
#include <windows.h>
43

54
Event::Event() noexcept { handle = (void*)CreateEvent(NULL, FALSE, FALSE, NULL); }
65
Event::~Event() noexcept { CloseHandle(handle); }

src/xrCore/Threading/Event.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
class XRCORE_API Event
55
{
6-
private:
76
void* handle;
87

98
public:

src/xrCore/_math.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "stdafx.h"
22
#pragma hdrstop
33

4+
#include <intrin.h> // __rdtsc
45
#include <process.h>
56
#include <powerbase.h>
67

@@ -100,14 +101,10 @@ XRCORE_API u64 QPC() noexcept
100101
return _dest;
101102
}
102103

103-
#ifdef M_BORLAND
104-
u64 __fastcall GetCLK(void)
104+
XRCORE_API u64 GetCLK()
105105
{
106-
_asm db 0x0F;
107-
_asm db 0x31;
106+
return __rdtsc();
108107
}
109-
#endif
110-
111108
} // namespace CPU
112109

113110
bool g_initialize_cpu_called = false;

src/xrCore/_math.h

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#pragma once
2-
#ifndef __XR_MATH_H__
3-
#define __XR_MATH_H__
42

53
#include "_types.h"
64
#include "cpuid.h"
7-
#include "xrCommon/inlining_macros.h"
8-
#ifdef _MSC_VER
9-
#include <intrin.h> // __rdtsc
10-
#endif
115

126
namespace FPU
137
{
@@ -26,34 +20,13 @@ XRCORE_API extern u32 qpc_counter;
2620
XRCORE_API extern processor_info ID;
2721
XRCORE_API extern u64 QPC() noexcept;
2822

29-
#ifdef _MSC_VER
30-
// XXX: Stale checks. All MS' x86&x64 compilers cabable of compiling XRay-16 have __rdtsc
31-
//#ifndef _M_AMD64
32-
// This must have been an MS compiler from the stone age. Even MSVC6 (from 1998) understands __asm rdtsc.
33-
//#pragma warning(push)
34-
//#pragma warning(disable : 4035)
35-
//IC u64 GetCLK()
36-
//{
37-
// _asm _emit 0x0F;
38-
// _asm _emit 0x31;
39-
//}
40-
//#pragma warning(pop)
41-
//#else
42-
IC u64 GetCLK() { return __rdtsc(); }
43-
//#endif
44-
#endif // _MSC_VER, previously M_VISUAL
45-
46-
#ifdef M_BORLAND
47-
XRCORE_API u64 __fastcall GetCLK();
48-
#endif
49-
};
23+
XRCORE_API u64 GetCLK();
24+
}
5025

5126
extern XRCORE_API void _initialize_cpu();
5227
extern XRCORE_API void _initialize_cpu_thread();
5328

5429
// threading
55-
typedef void thread_t(void*);
30+
using thread_t = void(void*);
5631
extern XRCORE_API void thread_name(const char* name);
5732
extern XRCORE_API void thread_spawn(thread_t* entry, const char* name, unsigned stack, void* arglist);
58-
59-
#endif //__XR_MATH_H__

0 commit comments

Comments
 (0)