25#define PROMEKI_ASSERT(x) if(!(x)) { \
26 promekiErr("Assertion failed: " PROMEKI_STRINGIFY(x)); \
27 promekiLogStackTrace(Logger::Err); \
29 throw std::runtime_error(__FILE__ ":" PROMEKI_STRINGIFY(__LINE__) " Assertion failed: " PROMEKI_STRINGIFY(x)); \
33#define PROMEKI_STATIC_ASSERT(x) static_assert(x, __LINE__ ":" PROMEKI_STRINGIFY(__LINE__) " Assertion failed: " PROMEKI_STRINGIFY(x));
36#define PROMEKI_STRINGIFY_ARGS(...) #__VA_ARGS__
37#define PROMEKI_STRINGIFY_IMPL(value) #value
38#define PROMEKI_STRINGIFY(value) PROMEKI_STRINGIFY_IMPL(value)
39#define PROMEKI_CONCAT_IMPL(v1, v2) v1##v2
40#define PROMEKI_CONCAT(v1, v2) PROMEKI_CONCAT_IMPL(v1, v2)
43#define PROMEKI_UNIQUE_ID PROMEKI_CONCAT(__LINE__, __COUNTER__)
46#define PROMEKI_ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
49#define PROMEKI_ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1))
57#if defined(PROMEKI_COMPILER_GCC_COMPAT)
58# define PROMEKI_PRINTF_FUNC(m, n) __attribute__((format(printf, m, n)))
59#elif defined(PROMEKI_COMPILER_MSVC)
60# define PROMEKI_PRINTF_FUNC(m, n) _Printf_format_string_
62# define PROMEKI_PRINTF_FUNC(m, n)
83#if defined(PROMEKI_COMPILER_GCC_COMPAT)
84# define PROMEKI_PACKED_STRUCT_BEGIN
85# define PROMEKI_PACKED_STRUCT_END __attribute__((packed))
86#elif defined(PROMEKI_COMPILER_MSVC)
87# define PROMEKI_PACKED_STRUCT_BEGIN __pragma(pack(push, 1))
88# define PROMEKI_PACKED_STRUCT_END __pragma(pack(pop))
90# define PROMEKI_PACKED_STRUCT_BEGIN
91# define PROMEKI_PACKED_STRUCT_END
96template <
typename OutputType,
typename InputType>
98 static_assert(std::is_integral<InputType>::value || std::is_floating_point<InputType>::value,
99 "InputType must be an integer or floating point type");
100 static_assert(std::is_integral<OutputType>::value || std::is_floating_point<OutputType>::value,
101 "OutputType must be an integer or floating point type");
111inline T promekiLerp(
const T& a,
const T& b,
const double&
t) {
112 return a +
t * (b - a);
116T promekiCatmullRom(
const std::array<T, 4>&
points,
T t) {
127T promekiBezier(
const std::array<T, 4>&
points,
T t) {
141T promekiBicubic(
const std::array<std::array<T, 4>, 4>&
points,
T x,
T y) {
142 std::array<T, 4>
arr;
143 for (
int i = 0;
i < 4; ++
i) {
144 std::array<T, 4> row;
145 for (
int j = 0;
j < 4; ++
j) {
154T promekiCubic(
const std::array<T, 4>&
points,
T t) {
159 return a *
t *
t *
t + b *
t *
t +
c *
t + d;
Lightweight error code wrapper for the promeki library.
Definition error.h:39
@ Ok
No error.
Definition error.h:51
@ Invalid
Invalid value or argument (EINVAL).
Definition error.h:66
Dynamic array container wrapping std::vector.
Definition list.h:40
Manages a list of strings.
Definition stringlist.h:21
List()=default
Default constructor. Creates an empty list.
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19