Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Base/Bit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma once

// Returns a number with a single set bit at `index`.
#define BIT(index) (1 << (index))
#define ATL_BIT(index) (1 << (index))

namespace atl {
// Returns the minimum number of bits necessary to store `value`.
Expand Down
62 changes: 31 additions & 31 deletions Base/Context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,63 @@
#pragma once

// See https://sourceforge.net/p/predef/wiki/Standards.
#define STANDARD_OTHER 0
#define STANDARD_CPP11 201103l
#define STANDARD_CPP14 201402l
#define STANDARD_CPP17 201703l
#define STANDARD_CPP20 202002l
#define STANDARD_CPP23 202302l
#define ATL_STANDARD_OTHER 0
#define ATL_STANDARD_CPP11 201103l
#define ATL_STANDARD_CPP14 201402l
#define ATL_STANDARD_CPP17 201703l
#define ATL_STANDARD_CPP20 202002l
#define ATL_STANDARD_CPP23 202302l

#if defined(_MSVC_LANG)
#define STANDARD _MSVC_LANG
#define ATL_STANDARD _MSVC_LANG
#elif
#define STANDARD __cplusplus
#define ATL_STANDARD __cplusplus
#endif

// See https://sourceforge.net/p/predef/wiki/Compilers.
#define COMPILER_OTHER 0
#define COMPILER_CLANG 1
#define COMPILER_GCC 2
#define COMPILER_MSVC 3
#define ATL_COMPILER_OTHER 0
#define ATL_COMPILER_CLANG 1
#define ATL_COMPILER_GCC 2
#define ATL_COMPILER_MSVC 3

#if defined(__clang__)
#define COMPILER COMPILER_CLANG
#define ATL_COMPILER ATL_COMPILER_CLANG
#elif defined(__GNUC__)
#define COMPILER COMPILER_GCC
#define ATL_COMPILER ATL_COMPILER_GCC
#elif defined(_MSC_VER)
#define COMPILER COMPILER_MSVC
#define ATL_COMPILER ATL_COMPILER_MSVC
#else
#define COMPILER COMPILER_OTHER
#define ATL_COMPILER ATL_COMPILER_OTHER
#endif

// See https://sourceforge.net/p/predef/wiki/OperatingSystems.
#define OPERATING_SYSTEM_OTHER 0
#define OPERATING_SYSTEM_LINUX 1
#define OPERATING_SYSTEM_WINDOWS 2
#define ATL_OPERATING_SYSTEM_OTHER 0
#define ATL_OPERATING_SYSTEM_LINUX 1
#define ATL_OPERATING_SYSTEM_WINDOWS 2

#if defined(__gnu_linux__)
#define OPERATING_SYSTEM OPERATING_SYSTEM_LINUX
#define ATL_OPERATING_SYSTEM ATL_OPERATING_SYSTEM_LINUX
#elif defined(_WIN16) || defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
#define OPERATING_SYSTEM OPERATING_SYSTEM_WINDOWS
#define ATL_OPERATING_SYSTEM ATL_OPERATING_SYSTEM_WINDOWS
#else
#define OPERATING_SYSTEM OPERATING_SYSTEM_OTHER
#define ATL_OPERATING_SYSTEM ATL_OPERATING_SYSTEM_OTHER
#endif

// See https://sourceforge.net/p/predef/wiki/Architectures.
#define ARCHITECTURE_OTHER 0
#define ARCHITECTURE_AMD64 1
#define ARCHITECTURE_INTEL_X86 2
#define ATL_ARCHITECTURE_OTHER 0
#define ATL_ARCHITECTURE_AMD64 1
#define ATL_ARCHITECTURE_INTEL_X86 2

#if defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
#define ARCHITECTURE ARCHITECTURE_AMD64
#define ATL_ARCHITECTURE ATL_ARCHITECTURE_AMD64
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(__IA32__) || defined(_M_I86) || defined(_M_IX86) || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || defined(__INTEL__) || defined(__386)
#define ARCHITECTURE ARCHITECTURE_INTEL_X86
#define ATL_ARCHITECTURE ATL_ARCHITECTURE_INTEL_X86
#else
#define ARCHITECTURE ARCHITECTURE_OTHER
#define ATL_ARCHITECTURE ATL_ARCHITECTURE_OTHER
#endif

#if STANDARD >= STANDARD_CPP17
#define CONSTEXPR_CPP17 constexpr
#if ATL_STANDARD >= ATL_STANDARD_CPP17
#define ATL_CONSTEXPR_CPP17 constexpr
#else
#define CONSTEXPR_CPP17
#define ATL_CONSTEXPR_CPP17
#endif
24 changes: 12 additions & 12 deletions Base/Macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@

#pragma once

#define ABORT() std::abort()
#define ATL_ABORT() std::abort()

#ifdef NDEBUG
#define ASSERT(expression)
#define BREAKPOINT()
#define ATL_ASSERT(expression)
#define ATL_BREAKPOINT()
#else
#include <cassert>

// See https://stackoverflow.com/a/49079078.
#if COMPILER == COMPILER_CLANG
#if ATL_COMPILER == ATL_COMPILER_CLANG
#if __has_builtin(__builtin_debugtrap)
#define BREAKPOINT() __builtin_debugtrap()
#define ATL_BREAKPOINT() __builtin_debugtrap()
#else
#define BREAKPOINT()
#define ATL_BREAKPOINT()
#endif
#elif COMPILER == COMPILER_GCC
#define BREAKPOINT() __builtin_trap()
#elif COMPILER == COMPILER_MSVC
#define BREAKPOINT() __debugbreak()
#elif ATL_COMPILER == ATL_COMPILER_GCC
#define ATL_BREAKPOINT() __builtin_trap()
#elif ATL_COMPILER == ATL_COMPILER_MSVC
#define ATL_BREAKPOINT() __debugbreak()
#else
#define BREAKPOINT()
#define ATL_BREAKPOINT()
#endif

#define ASSERT(expression) assert(expression)
#define ATL_ASSERT(expression) assert(expression)
#endif
6 changes: 3 additions & 3 deletions Base/Types/base_sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace atl {
}

void operator=(base_sequence<T>&& sequence) noexcept {
ASSERT(_data != sequence._data);
ATL_ASSERT(_data != sequence._data);

_count = sequence._count;
_data = sequence._data;
Expand All @@ -73,13 +73,13 @@ namespace atl {
}

const T& operator[](uint64 index) const {
ASSERT(index < _count);
ATL_ASSERT(index < _count);

return _data[index];
}

T& operator[](uint64 index) {
ASSERT(index < _count);
ATL_ASSERT(index < _count);

return _data[index];
}
Expand Down
2 changes: 1 addition & 1 deletion Base/Types/base_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace atl {
}

const T& operator[](uint64 index) const {
ASSERT(index < _count);
ATL_ASSERT(index < _count);

return _data[index];
}
Expand Down
2 changes: 1 addition & 1 deletion Base/Types/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace atl {
using base_view<char8>::base_view;

// TODO: Add support for versions below C++17.
CONSTEXPR_CPP17 view<char8>(const char8* data) :
ATL_CONSTEXPR_CPP17 view<char8>(const char8* data) :
view<char8>(data, std::char_traits<char8>::length(data))
{}

Expand Down