UraniumCompute 0.1.0
A GPU accelerated parallel task scheduler
PlatformTraits.h
1#pragma once
2#include <csignal>
3#include <malloc.h>
4
5#if defined _WIN32 || defined _WIN64 || defined _WINDOWS || defined DOXYGEN
6# define UN_WINDOWS 1
7
9# define UN_DLL_EXTENSION ".dll"
11# define UN_EXE_EXTENSION ".exe"
13# define UN_PATH_SEPARATOR '\\'
15# define UN_OS_NAME "Windows"
16
18# define UN_ALIGNED_MALLOC(size, alignment) _aligned_malloc(size, alignment)
20# define UN_ALIGNED_FREE(ptr) _aligned_free(ptr)
21
23# define UN_BYTE_SWAP_UINT16(value) _byteswap_ushort(value)
25# define UN_BYTE_SWAP_UINT32(value) _byteswap_ulong(value)
27# define UN_BYTE_SWAP_UINT64(value) _byteswap_uint64(value)
28
30# define UN_DLL_EXPORT __declspec(dllexport)
32# define UN_DLL_IMPORT __declspec(dllimport)
33
34#elif defined __linux__
35# define UN_LINUX 1
36
37# define UN_DLL_EXTENSION ".so"
38# define UN_EXE_EXTENSION ""
39# define UN_PATH_SEPARATOR '/'
40# define UN_OS_NAME "Linux"
41
42# define UN_ALIGNED_MALLOC(size, alignment) ::memalign(alignment, size)
43# define UN_ALIGNED_FREE(ptr) ::free(ptr)
44
45# define UN_BYTE_SWAP_UINT16(value) __builtin_bswap16(value)
46# define UN_BYTE_SWAP_UINT32(value) __builtin_bswap32(value)
47# define UN_BYTE_SWAP_UINT64(value) __builtin_bswap64(value)
48
49# define UN_DLL_EXPORT __attribute__((visibility("default")))
50# define UN_DLL_IMPORT __attribute__((visibility("default")))
51
52#else
53# error Unsupported platform
54#endif