Skip to content

Commit

Permalink
xrCore/math.h|cpp: cleanup
Browse files Browse the repository at this point in the history
xrCore/Threading/Event.hpp|cpp: cleanup
  • Loading branch information
Xottab-DUTY committed Apr 3, 2018
1 parent 6cee0e7 commit 992096c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 38 deletions.
1 change: 0 additions & 1 deletion src/xrCore/Threading/Event.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "stdafx.h"
#include "Event.hpp"
#include <windows.h>

Event::Event() noexcept { handle = (void*)CreateEvent(NULL, FALSE, FALSE, NULL); }
Event::~Event() noexcept { CloseHandle(handle); }
Expand Down
1 change: 0 additions & 1 deletion src/xrCore/Threading/Event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

class XRCORE_API Event
{
private:
void* handle;

public:
Expand Down
9 changes: 3 additions & 6 deletions src/xrCore/_math.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "stdafx.h"
#pragma hdrstop

#include <intrin.h> // __rdtsc
#include <process.h>
#include <powerbase.h>

Expand Down Expand Up @@ -100,14 +101,10 @@ XRCORE_API u64 QPC() noexcept
return _dest;
}

#ifdef M_BORLAND
u64 __fastcall GetCLK(void)
XRCORE_API u64 GetCLK()
{
_asm db 0x0F;
_asm db 0x31;
return __rdtsc();
}
#endif

} // namespace CPU

bool g_initialize_cpu_called = false;
Expand Down
33 changes: 3 additions & 30 deletions src/xrCore/_math.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#pragma once
#ifndef __XR_MATH_H__
#define __XR_MATH_H__

#include "_types.h"
#include "cpuid.h"
#include "xrCommon/inlining_macros.h"
#ifdef _MSC_VER
#include <intrin.h> // __rdtsc
#endif

namespace FPU
{
Expand All @@ -26,34 +20,13 @@ XRCORE_API extern u32 qpc_counter;
XRCORE_API extern processor_info ID;
XRCORE_API extern u64 QPC() noexcept;

#ifdef _MSC_VER
// XXX: Stale checks. All MS' x86&x64 compilers cabable of compiling XRay-16 have __rdtsc
//#ifndef _M_AMD64
// This must have been an MS compiler from the stone age. Even MSVC6 (from 1998) understands __asm rdtsc.
//#pragma warning(push)
//#pragma warning(disable : 4035)
//IC u64 GetCLK()
//{
// _asm _emit 0x0F;
// _asm _emit 0x31;
//}
//#pragma warning(pop)
//#else
IC u64 GetCLK() { return __rdtsc(); }
//#endif
#endif // _MSC_VER, previously M_VISUAL

#ifdef M_BORLAND
XRCORE_API u64 __fastcall GetCLK();
#endif
};
XRCORE_API u64 GetCLK();
}

extern XRCORE_API void _initialize_cpu();
extern XRCORE_API void _initialize_cpu_thread();

// threading
typedef void thread_t(void*);
using thread_t = void(void*);
extern XRCORE_API void thread_name(const char* name);
extern XRCORE_API void thread_spawn(thread_t* entry, const char* name, unsigned stack, void* arglist);

#endif //__XR_MATH_H__

0 comments on commit 992096c

Please sign in to comment.