12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef _SCTL_COMMON_HPP_
- #define _SCTL_COMMON_HPP_
- // Define NULL
- #ifndef NULL
- #define NULL 0
- #endif
- #include <cstddef>
- #include <cstdint>
- namespace SCTL_NAMESPACE {
- typedef long Integer; // bounded numbers < 32k
- typedef int64_t Long; // problem size
- }
- #include <iostream>
- #define SCTL_WARN(msg) \
- do { \
- std::cerr << "\n\033[1;31mWarning:\033[0m " << msg << '\n'; \
- } while (0)
- #define SCTL_ERROR(msg) \
- do { \
- std::cerr << "\n\033[1;31mError:\033[0m " << msg << '\n'; \
- abort(); \
- } while (0)
- #define SCTL_ASSERT_MSG(cond, msg) \
- do { \
- if (!(cond)) SCTL_ERROR(msg); \
- } while (0)
- #define SCTL_ASSERT(cond) \
- do { \
- if (!(cond)) { \
- fprintf(stderr, "\n%s:%d: %s: Assertion `%s' failed.\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond); \
- abort(); \
- } \
- } while (0)
- #define SCTL_UNUSED(x) (void)(x) // to ignore unused variable warning.
- namespace SCTL_NAMESPACE {
- #ifdef SCTL_MEMDEBUG
- template <class ValueType> class ConstIterator;
- template <class ValueType> class Iterator;
- template <class ValueType, Long DIM> class StaticArray;
- #else
- template <typename ValueType> using Iterator = ValueType*;
- template <typename ValueType> using ConstIterator = const ValueType*;
- template <typename ValueType, Long DIM> using StaticArray = ValueType[DIM];
- #endif
- }
- #include SCTL_INCLUDE(math_utils.hpp)
- #endif //_SCTL_COMMON_HPP_
|