HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Variables
architecture.hpp File Reference

Functions and macros for handling architectural difference between compilers, CPUs and operating systems. More...

#include <exception>
#include <cstddef>
#include <type_traits>

Go to the source code of this file.

Macros

#define HI_BT_DEBUG   'D'
 
#define HI_BT_RELEASE   'R'
 
#define HI_BUILD_TYPE   HI_BT_DEBUG
 
#define HI_OS_WINDOWS   'W'
 
#define HI_OS_MACOS   'A'
 
#define HI_OS_MOBILE   'M'
 
#define HI_OS_OTHER   'O'
 
#define HI_OPERATING_SYSTEM   HI_OS_OTHER
 
#define HI_CC_MSVC   'm'
 
#define HI_CC_GCC   'g'
 
#define HI_CC_CLANG   'c'
 
#define HI_CPU_X64   'i'
 
#define HI_CPU_ARM   'a'
 
#define HI_CPU_UNKNOWN   'u'
 
#define HI_PROCESSOR   HI_CPU_UNKNOWN
 
#define HI_X86_64_V1   1
 
#define HI_HAS_SSE
 
#define HI_HAS_SSE2
 
#define hi_stringify_(x)   #x
 
#define hi_stringify(x)   hi_stringify_(x)
 
#define hi_cat_(a, b)   a ## b
 
#define hi_cat(a, b)   hi_cat_(a, b)
 
#define hi_unreachable()   __assume(0)
 Marker to tell the compiler that this line will never be executed.
 
#define hi_assume(condition)   __assume(condition)
 Mark an expression as true.
 
#define hi_force_inline   __forceinline
 
#define hi_no_inline   __declspec(noinline)
 
#define hi_restrict   __restrict
 
#define hi_warning_push()   _Pragma("warning( push )")
 
#define hi_warning_pop()   _Pragma("warning( pop )")
 
#define hi_msvc_pragma(a)   _Pragma(a)
 
#define hi_msvc_suppress(code)   _Pragma(hi_stringify(warning(disable:code)))
 
#define hi_clang_suppress(a)
 
#define hi_export   __declspec(dllexport)
 Attribute to export a function, class, variable in the shared library or dll.
 

Typedefs

using v1::os_handle = void *
 
using v1::file_handle = os_handle
 

Enumerations

enum class  build_type { debug = HI_BT_DEBUG , release = HI_BT_RELEASE , current = HI_BUILD_TYPE }
 
enum class  operating_system {
  windows = HI_OS_WINDOWS , macos = HI_OS_MACOS , mobile = HI_OS_MOBILE , other = HI_OS_OTHER ,
  current = HI_OPERATING_SYSTEM
}
 
enum class  compiler { msvc = HI_CC_MSVC , gcc = HI_CC_GCC , clang = HI_CC_CLANG , current = HI_COMPILER }
 
enum class  processor { x64 = HI_CPU_X64 , arm = HI_CPU_ARM , unknown = HI_CPU_UNKNOWN , current = HI_PROCESSOR }
 

Variables

constexpr bool v1::x86_64_v1 = true
 
constexpr bool v1::x86_64_v2 = false
 
constexpr bool v1::x86_64_v2_5 = false
 
constexpr bool v1::x86_64_v3 = false
 
constexpr bool v1::x86_64_v4 = false
 
constexpr std::size_t v1::hardware_destructive_interference_size = 128
 Minimum offset between two objects to avoid false sharing.
 
constexpr std::size_t v1::hardware_constructive_interference_size = 64
 Maximum size of contiguous memory to promote true sharing.
 

Detailed Description

Functions and macros for handling architectural difference between compilers, CPUs and operating systems.

Macro Definition Documentation

◆ hi_assume

#define hi_assume ( condition)    __assume(condition)

Mark an expression as true.

The expression inside hi_assume() can be used by the compiler to optimize the code (before and after) based on the fact that the expression is true.

◆ hi_export

#define hi_export   __declspec(dllexport)

Attribute to export a function, class, variable in the shared library or dll.

◆ hi_unreachable

#define hi_unreachable ( )    __assume(0)

Marker to tell the compiler that this line will never be executed.

This marker allows the compiler to do certain optimization.

Variable Documentation

◆ hardware_constructive_interference_size

constexpr std::size_t v1::hardware_constructive_interference_size = 64
constexpr

Maximum size of contiguous memory to promote true sharing.

Guaranteed to be at least alignof(std::max_align_t) Part of c++17 but never implemented by clang or gcc.

◆ hardware_destructive_interference_size

constexpr std::size_t v1::hardware_destructive_interference_size = 128
constexpr

Minimum offset between two objects to avoid false sharing.

Guaranteed to be at least alignof(std::max_align_t) Part of c++17 but never implemented by clang or gcc.