libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
blatant_old_msvc_compiler_hacks.hpp File Reference
#include "config.h"
#include <new>
Include dependency graph for blatant_old_msvc_compiler_hacks.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define JMMCG_MSVC_STDCALL_HACK   __stdcall
 Work arounds for the older MSVC++ compilers being very broken regarding the use of various keywords. More...
 
#define JMMCG_MSVC_FASTCALL_HACK   __fastcall
 
#define _CRT_SECURE_NO_WARNINGS
 
#define _WIN32_WINNT   0x0501
 
#define WINVER   _WIN32_WINNT
 
#define __fastcall
 
#define __stdcall
 
#define __cdecl
 
#define __CLR_OR_THIS_CALL
 
#define __declspec(dllexport)
 
#define LIKELY(x)   __builtin_expect(!!(x), 1)
 
#define UNLIKELY(x)   __builtin_expect(!!(x), 0)
 
#define REALLY_FORCE_INLINE   __attribute__((always_inline))
 
#define FORCE_INLINE
 
#define NEVER_INLINE   __attribute__((cold, noinline))
 
#define POPCOUNTLL(x)   __builtin_popcountll(x)
 
#define PREFETCH_READ(addr, locality)   __builtin_prefetch(reinterpret_cast<void const *>(addr), 0, (locality))
 
#define _MM_HINT_NTA   0
 
#define PREFETCH_WRITE(addr, locality)   __builtin_prefetch(reinterpret_cast<void const *>(addr), 1, (locality))
 
#define ALIGN_TO_L1_CACHE   alignas(64 /* TODO std::hardware_constructive_interference_size */)
 
#define LIBJMMCG_ENQUOTE_INTERNAL(x)   #x
 
#define LIBJMMCG_ENQUOTE(x)   LIBJMMCG_ENQUOTE_INTERNAL(x)
 

Typedefs

typedef long long __int64
 Yup: MSVC++ doesn't support "long long" properly.... Better use the MSVC++-special types. More...
 
typedef unsigned long long __uint64
 

Detailed Description

This file contains some of the more blatant, nasty, evil hacks that need to be done to work-around the venerable MSVC++ v6.0 sp5 compiler's "features". Note that this compiler should really be referred to as "cl.exe" v12.00.8168.

Definition in file blatant_old_msvc_compiler_hacks.hpp.

Macro Definition Documentation

◆ __cdecl

#define __cdecl

Definition at line 168 of file blatant_old_msvc_compiler_hacks.hpp.

◆ __CLR_OR_THIS_CALL

#define __CLR_OR_THIS_CALL

Definition at line 171 of file blatant_old_msvc_compiler_hacks.hpp.

◆ __declspec

__declspec (   dllexport)

Definition at line 174 of file blatant_old_msvc_compiler_hacks.hpp.

◆ __fastcall

#define __fastcall

Definition at line 160 of file blatant_old_msvc_compiler_hacks.hpp.

◆ __stdcall

#define __stdcall

Definition at line 164 of file blatant_old_msvc_compiler_hacks.hpp.

◆ _CRT_SECURE_NO_WARNINGS

#define _CRT_SECURE_NO_WARNINGS

Definition at line 43 of file blatant_old_msvc_compiler_hacks.hpp.

◆ _MM_HINT_NTA

#define _MM_HINT_NTA   0

Definition at line 202 of file blatant_old_msvc_compiler_hacks.hpp.

◆ _WIN32_WINNT

#define _WIN32_WINNT   0x0501

Definition at line 46 of file blatant_old_msvc_compiler_hacks.hpp.

◆ ALIGN_TO_L1_CACHE

#define ALIGN_TO_L1_CACHE   alignas(64 /* TODO std::hardware_constructive_interference_size */)

Definition at line 214 of file blatant_old_msvc_compiler_hacks.hpp.

◆ FORCE_INLINE

#define FORCE_INLINE

Definition at line 183 of file blatant_old_msvc_compiler_hacks.hpp.

◆ JMMCG_MSVC_FASTCALL_HACK

#define JMMCG_MSVC_FASTCALL_HACK   __fastcall

Definition at line 40 of file blatant_old_msvc_compiler_hacks.hpp.

◆ JMMCG_MSVC_STDCALL_HACK

#define JMMCG_MSVC_STDCALL_HACK   __stdcall

Work arounds for the older MSVC++ compilers being very broken regarding the use of various keywords.

Definition at line 39 of file blatant_old_msvc_compiler_hacks.hpp.

◆ LIBJMMCG_ENQUOTE

#define LIBJMMCG_ENQUOTE (   x)    LIBJMMCG_ENQUOTE_INTERNAL(x)

Definition at line 217 of file blatant_old_msvc_compiler_hacks.hpp.

◆ LIBJMMCG_ENQUOTE_INTERNAL

#define LIBJMMCG_ENQUOTE_INTERNAL (   x)    #x

Definition at line 216 of file blatant_old_msvc_compiler_hacks.hpp.

◆ LIKELY

#define LIKELY (   x)    __builtin_expect(!!(x), 1)

GCC has "quirks" in it's static branch-prediction: Branch prediction in gcc. Use these to ensure that if-statements are generated reliably.

Definition at line 179 of file blatant_old_msvc_compiler_hacks.hpp.

◆ NEVER_INLINE

#define NEVER_INLINE   __attribute__((cold, noinline))

Definition at line 184 of file blatant_old_msvc_compiler_hacks.hpp.

◆ POPCOUNTLL

#define POPCOUNTLL (   x)    __builtin_popcountll(x)

Definition at line 190 of file blatant_old_msvc_compiler_hacks.hpp.

◆ PREFETCH_READ

#define PREFETCH_READ (   addr,
  locality 
)    __builtin_prefetch(reinterpret_cast<void const *>(addr), 0, (locality))

See GCC Intrinsics and Prefetching strides for more information.

Parameters
addrPrefetch a cache line from the address addr for reading. See the kernel marco L1_CACHE_BYTES for an approximation.
localityA compile-time integer constant in [1 .. 3], default 3. 1 means low locality, 3 highest.

Definition at line 198 of file blatant_old_msvc_compiler_hacks.hpp.

◆ PREFETCH_WRITE

#define PREFETCH_WRITE (   addr,
  locality 
)    __builtin_prefetch(reinterpret_cast<void const *>(addr), 1, (locality))

See GCC Intrinsics and Prefetching strides for more information.

Parameters
addrPrefetch a cache line from the address addr for writing. See the kernel marco L1_CACHE_BYTES for an approximation.
localityA compile-time integer constant in [1 .. 3], default 3. 1 means low locality, 3 highest.

Definition at line 210 of file blatant_old_msvc_compiler_hacks.hpp.

◆ REALLY_FORCE_INLINE

#define REALLY_FORCE_INLINE   __attribute__((always_inline))

Definition at line 181 of file blatant_old_msvc_compiler_hacks.hpp.

◆ UNLIKELY

#define UNLIKELY (   x)    __builtin_expect(!!(x), 0)

Definition at line 180 of file blatant_old_msvc_compiler_hacks.hpp.

◆ WINVER

#define WINVER   _WIN32_WINNT

Definition at line 49 of file blatant_old_msvc_compiler_hacks.hpp.

Typedef Documentation

◆ __int64

typedef long long __int64

Yup: MSVC++ doesn't support "long long" properly.... Better use the MSVC++-special types.

Definition at line 187 of file blatant_old_msvc_compiler_hacks.hpp.

◆ __uint64

typedef unsigned long long __uint64

Definition at line 188 of file blatant_old_msvc_compiler_hacks.hpp.