Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
20
src/cpu.cpp
20
src/cpu.cpp
@@ -19,7 +19,7 @@
|
||||
#if defined(_MSC_VER) && !defined(RDTSC_AVAILABLE)
|
||||
#include <intrin.h>
|
||||
#include <windows.h>
|
||||
uint64 ottd_rdtsc()
|
||||
uint64_t ottd_rdtsc()
|
||||
{
|
||||
#if defined(_M_ARM)
|
||||
return __rdpmccntr64();
|
||||
@@ -34,20 +34,20 @@ uint64 ottd_rdtsc()
|
||||
|
||||
/* rdtsc for all other *nix-en (hopefully). Use GCC syntax */
|
||||
#if (defined(__i386__) || defined(__x86_64__)) && !defined(RDTSC_AVAILABLE)
|
||||
uint64 ottd_rdtsc()
|
||||
uint64_t ottd_rdtsc()
|
||||
{
|
||||
uint32 high, low;
|
||||
uint32_t high, low;
|
||||
__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high));
|
||||
return ((uint64)high << 32) | low;
|
||||
return ((uint64_t)high << 32) | low;
|
||||
}
|
||||
# define RDTSC_AVAILABLE
|
||||
#endif
|
||||
|
||||
/* rdtsc for PPC which has this not */
|
||||
#if (defined(__POWERPC__) || defined(__powerpc__)) && !defined(RDTSC_AVAILABLE)
|
||||
uint64 ottd_rdtsc()
|
||||
uint64_t ottd_rdtsc()
|
||||
{
|
||||
uint32 high = 0, high2 = 0, low;
|
||||
uint32_t high = 0, high2 = 0, low;
|
||||
/* PPC does not have rdtsc, so we cheat by reading the two 32-bit time-counters
|
||||
* it has, 'Move From Time Base (Upper)'. Since these are two reads, in the
|
||||
* very unlikely event that the lower part overflows to the upper part while we
|
||||
@@ -61,14 +61,14 @@ uint64 ottd_rdtsc()
|
||||
: "=r" (high), "=r" (low), "=r" (high2)
|
||||
: "0" (high), "2" (high2)
|
||||
);
|
||||
return ((uint64)high << 32) | low;
|
||||
return ((uint64_t)high << 32) | low;
|
||||
}
|
||||
# define RDTSC_AVAILABLE
|
||||
#endif
|
||||
|
||||
/* rdtsc for MCST Elbrus 2000 */
|
||||
#if defined(__e2k__) && !defined(RDTSC_AVAILABLE)
|
||||
uint64 ottd_rdtsc()
|
||||
uint64_t ottd_rdtsc()
|
||||
{
|
||||
uint64_t dst;
|
||||
# pragma asm_inline
|
||||
@@ -80,7 +80,7 @@ uint64 ottd_rdtsc()
|
||||
|
||||
#if defined(__EMSCRIPTEN__) && !defined(RDTSC_AVAILABLE)
|
||||
/* On emscripten doing TIC/TOC would be ill-advised */
|
||||
uint64 ottd_rdtsc() {return 0;}
|
||||
uint64_t ottd_rdtsc() {return 0;}
|
||||
# define RDTSC_AVAILABLE
|
||||
#endif
|
||||
|
||||
@@ -88,7 +88,7 @@ uint64 ottd_rdtsc() {return 0;}
|
||||
* you just won't be able to profile your code with TIC()/TOC() */
|
||||
#if !defined(RDTSC_AVAILABLE)
|
||||
#warning "(non-fatal) No support for rdtsc(), you won't be able to profile with TIC/TOC"
|
||||
uint64 ottd_rdtsc() {return 0;}
|
||||
uint64_t ottd_rdtsc() {return 0;}
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user