The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
Kernel.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
13// Large integer definition depends of the platform
14#ifndef NO_LONGLONG_TYPEDEF
15typedef long long int longlong;
16typedef unsigned long long int ulonglong;
17#endif
18
19#ifndef LONGLONG_MAX
20# define LONGLONG_MAX 0x7FFFFFFFFFFFFFFFLL
21#endif
22#ifndef LONGLONG_MIN
23# define LONGLONG_MIN 0x8000000000000000LL
24#endif
25
26#ifndef ULONGLONG_MAX
27# define ULONGLONG_MAX 0xfFFFFFFFFFFFFFFFLL
28#endif
29#ifndef ULONGLONG_MIN
30# define ULONGLONG_MIN 0x0000000000000000LL
31#endif
32
33// ---------------------------------- Symbol visibility macros (begin)
34#if defined( G21_HIDE_SYMBOLS )
35// These macros will allow selection on exported symbols
36// taken from http://gcc.gnu.org/wiki/Visibility
37# if __GNUC__ >= 4 && !defined( __CINT__ )
38# define GAUDI_HASCLASSVISIBILITY
39# endif
40
41// Define GAUDI_API for DLL builds
42# ifdef GAUDI_LINKER_LIBRARY
43# define GAUDI_API GAUDI_EXPORT
44# else
45# define GAUDI_API GAUDI_IMPORT
46# endif
47#else
48// Dummy definitions for the backward compatibility mode.
49# define GAUDI_API
50# define GAUDI_IMPORT
51# define GAUDI_EXPORT
52# define GAUDI_LOCAL
53#endif
54// ---------------------------------- Symbol visibility macros (end)
55
56// -----------------------------------------------------------------------------
57// Sanitizer suppressions
58// Gcc
59#if defined( __GNUC__ )
60# if defined( __SANITIZE_ADDRESS__ )
61# define GAUDI_NO_SANITIZE_ADDRESS __attribute__( ( no_sanitize_address ) )
62# endif
63// Note there is no __SANITIZE_MEMORY__ to test for
64# define GAUDI_NO_SANITIZE_MEMORY __attribute__( ( no_sanitize_memory ) )
65// Note there is no __SANITIZE_UNDEFINED__ to test for
66# define GAUDI_NO_SANITIZE_UNDEFINED __attribute__( ( no_sanitize_undefined ) )
67// Note there is no __SANITIZE_THREAD__ to test for
68# define GAUDI_NO_SANITIZE_THREAD __attribute__( ( no_sanitize_thread ) )
69#endif
70// clang
71#if defined( __clang__ )
72# if __has_feature( address_sanitizer )
73# define GAUDI_NO_SANITIZE_ADDRESS __attribute__( ( no_sanitize( "address" ) ) )
74# endif
75# if __has_feature( memory_sanitizer )
76# define GAUDI_NO_SANITIZE_MEMORY __attribute__( ( no_sanitize( "memory" ) ) )
77# endif
78# if __has_feature( undefined_sanitizer )
79# define GAUDI_NO_SANITIZE_UNDEFINED __attribute__( ( no_sanitize( "undefined" ) ) )
80# endif
81# if __has_feature( thread_sanitizer )
82# define GAUDI_NO_SANITIZE_THREAD __attribute__( ( no_sanitize( "thread" ) ) )
83# endif
84#endif
85// defaults
86#ifndef GAUDI_NO_SANITIZE_ADDRESS
87# define GAUDI_NO_SANITIZE_ADDRESS
88#endif
89#ifndef GAUDI_NO_SANITIZE_MEMORY
90# define GAUDI_NO_SANITIZE_MEMORY
91#endif
92#ifndef GAUDI_NO_SANITIZE_UNDEFINED
93# define GAUDI_NO_SANITIZE_UNDEFINED
94#endif
95#ifndef GAUDI_NO_SANITIZE_THREAD
96# define GAUDI_NO_SANITIZE_THREAD
97#endif
98// -----------------------------------------------------------------------------
99
100// -----------------------------------------------------------------------------
101// Adds compiler specific hints for loop unrolling.
102// To use place the macro directly before the loop you wish to unroll. e.g.
103//
104// GAUDI_LOOP_UNROLL(N)
105// for ( std::size_t i = 0; i < N; ++i ) {
106// // do stuff
107// }
108//
109// Constraints on N are it needs to be something known at compile time.
110// Gains are most obvious with small fixed size (compile time) loops,
111// but in principle can be used with any loop.
112#define GAUDI_DO_PRAGMA( x ) _Pragma( #x )
113#if defined( __clang__ )
114# define GAUDI_LOOP_UNROLL( x ) GAUDI_DO_PRAGMA( clang loop unroll_count( x ) )
115#elif defined( __GNUC__ )
116# define GAUDI_LOOP_UNROLL( x ) GAUDI_DO_PRAGMA( GCC unroll x )
117#else
118# define GAUDI_LOOP_UNROLL( x )
119#endif
120// -----------------------------------------------------------------------------
unsigned long long int ulonglong
Definition Kernel.h:16
long long int longlong
Definition Kernel.h:15