ROOT-Sim core
3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
src
core
intrinsics.h
Go to the documentation of this file.
1
13
#pragma once
14
15
#include <assert.h>
16
26
#define intrinsics_ctz(x) \
27
__extension__({ \
28
assert((x) != 0); \
29
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned), __builtin_ctz(x), \
30
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned long), \
31
__builtin_ctzl(x), \
32
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned long long), \
33
__builtin_ctzll(x), (void)0))); \
34
})
35
45
#define intrinsics_clz(x) \
46
__extension__({ \
47
assert((x) != 0); \
48
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned), __builtin_clz(x), \
49
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned long), \
50
__builtin_clzl(x), \
51
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned long long), \
52
__builtin_clzll(x), (void)0))); \
53
})
54
64
#define intrinsics_popcount(x) \
65
__extension__({ \
66
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned), __builtin_popcount(x), \
67
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned long), \
68
__builtin_popcountl(x), \
69
__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(x), unsigned long long), \
70
__builtin_popcountll(x), (void)0))); \
71
})
Generated by
1.9.1