10#define TF_OS_DRAGONFLY 0
11#define TF_OS_FREEBSD 0
13#define TF_OS_OPENBSD 0
15#define TF_OS_WINDOWS 0
18#define TF_OS_SOLARIS 0
23#define TF_OS_WINDOWS 1
28#define TF_OS_WINDOWS 1
31#if (defined __APPLE__ && defined __MACH__)
40#elif (defined __linux__)
46#if (defined __DragonFly__)
48#define TF_OS_DRAGONFLY 1
51#if (defined __FreeBSD__)
53#define TF_OS_FREEBSD 1
56#if (defined __NetBSD__)
61#if (defined __OpenBSD__)
63#define TF_OS_OPENBSD 1
78#define TF_OS_SOLARIS 1
82 TF_OS_LINUX + TF_OS_DRAGONFLY + TF_OS_FREEBSD + TF_OS_NETBSD + \
83 TF_OS_OPENBSD + TF_OS_DARWIN + TF_OS_WINDOWS + TF_OS_HURD + \
85#define TF_OS_UNKNOWN 1
88#if TF_OS_LINUX || TF_OS_DRAGONFLY || TF_OS_FREEBSD || TF_OS_NETBSD || \
89 TF_OS_OPENBSD || TF_OS_DARWIN || TF_OS_HURD || TF_OS_SOLARIS
105#if defined(TF_POINTER_BITS)
108#elif defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64)
112 #define TF_POINTER_BITS 48
114#elif defined(__aarch64__) || defined(_M_ARM64)
115 #define TF_POINTER_BITS 48
117#elif defined(__riscv) && __riscv_xlen == 64
118 #define TF_POINTER_BITS 48
121 #define TF_POINTER_BITS (sizeof(void*) * CHAR_BIT)
133#if defined(__i386__) || defined(__x86_64__) || \
134 defined(_M_IX86) || defined(_M_AMD64)
136 #define TF_CACHELINE_SIZE 64
138#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
140 #define TF_CACHELINE_SIZE 64
142#elif defined(__arm__) || defined(_M_ARM)
144 #if defined(__ARM_ARCH_5T__) || \
145 defined(__ARM_ARCH_5TE__) || \
146 defined(__ARM_ARCH_6__)
147 #define TF_CACHELINE_SIZE 32
150 #define TF_CACHELINE_SIZE 64
153#elif defined(__powerpc64__) || defined(__ppc64__)
155 #define TF_CACHELINE_SIZE 128
157#elif defined(__powerpc__) || defined(__ppc__)
159 #define TF_CACHELINE_SIZE 32
161#elif defined(__s390x__) || defined(__zarch__)
163 #define TF_CACHELINE_SIZE 256
165#elif defined(__riscv)
167 #define TF_CACHELINE_SIZE 64
169#elif defined(__mips__) || defined(__mips64)
171 #define TF_CACHELINE_SIZE 64
173#elif defined(__sparc__) || defined(__sparc64__)
175 #define TF_CACHELINE_SIZE 64
177#elif defined(__loongarch64)
179 #define TF_CACHELINE_SIZE 64
181#elif defined(__alpha__)
183 #define TF_CACHELINE_SIZE 64
187#ifndef TF_CACHELINE_SIZE
191 #define TF_CACHELINE_SIZE 64
224 alignas (TF_CACHELINE_SIZE) T
data;
254inline std::string
get_env(
const std::string& str) {
259 if(_dupenv_s(&ptr, &len, str.c_str()) == 0 && ptr !=
nullptr) {
260 std::string res(ptr, len);
267 auto ptr = std::getenv(str.c_str());
268 return ptr ? ptr :
"";
289 if(_dupenv_s(&ptr, &len, str.c_str()) == 0 && ptr !=
nullptr) {
290 std::string res(ptr, len);
297 auto ptr = std::getenv(str.c_str());
298 return ptr ? true :
false;
class to ensure cacheline-aligned storage for an object.
Definition os.hpp:219
T & get()
accesses the underlying object
Definition os.hpp:231
const T & get() const
accesses the underlying object as a constant reference
Definition os.hpp:238
T data
The stored object, aligned to twice the cacheline size.
Definition os.hpp:224
taskflow namespace
Definition small_vector.hpp:20
std::string get_env(const std::string &str)
retrieves the value of an environment variable
Definition os.hpp:254
bool has_env(const std::string &str)
checks whether an environment variable is defined
Definition os.hpp:284