|
HikoGUI
A low latency retained GUI
|
Utilities used by the HikoGUI library itself. More...
#include <cstddef>#include <string>#include <chrono>Go to the source code of this file.
Data Structures | |
| struct | hi::v1::override_t |
| Tag used for special functions or constructions to do a override compared to another function of the same name. More... | |
| struct | hi::v1::intrinsic_t |
| Tag used in constructors to set the intrinsic value of that object. More... | |
| struct | hi::v1::unusable_t |
| A type that can not be constructed, copied, moved or destructed. More... | |
Namespaces | |
| namespace | hi |
| geometry/margins.hpp | |
| namespace | hi::v1 |
| The HikoGUI API version 1. | |
Macros | |
| #define | hilet auto const |
| Invariant should be the default for variables. | |
| #define | hi_forward(x) std::forward<decltype(x)>(x) |
| Forward a value, based on the decltype of the value. | |
| #define | hi_return_if_valid(expression) |
| Return the result of an expression if the expression is valid. | |
| #define | hi_num_va_args_impl(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, N, ...) N |
| #define | hi_num_va_args_(...) hi_num_va_args_impl(__VA_ARGS__) |
| #define | hi_num_va_args(...) |
| Get the number of arguments. | |
| #define | hi_parans () |
| #define | hi_expand1(...) __VA_ARGS__ |
| #define | hi_expand2(...) hi_expand1(hi_expand1(hi_expand1(hi_expand1(__VA_ARGS__)))) |
| #define | hi_expand3(...) hi_expand2(hi_expand2(hi_expand2(hi_expand2(__VA_ARGS__)))) |
| #define | hi_expand4(...) hi_expand3(hi_expand3(hi_expand3(hi_expand3(__VA_ARGS__)))) |
| #define | hi_expand(...) hi_expand4(hi_expand4(hi_expand4(hi_expand4(__VA_ARGS__)))) |
| Re-evaluate text up to 256 times by the pre-processor. | |
| #define | hi_for_each_again() hi_for_each_helper |
| #define | hi_for_each_helper(macro, first_arg, ...) macro(first_arg) __VA_OPT__(hi_for_each_again hi_parans(macro, __VA_ARGS__)) |
| #define | hi_for_each(macro, ...) __VA_OPT__(hi_expand(hi_for_each_helper(macro, __VA_ARGS__))) |
| Evaluate a macro for each argument. | |
| #define | hi_stringify_(x) #x |
| #define | hi_stringify(x) hi_stringify_(x) |
| #define | hi_cat_(a, b) a##b |
| #define | hi_cat(a, b) hi_cat_(a, b) |
| #define | hi_return_on_self_assignment(other) |
| #define | hi_get_overloaded_macro2(_1, _2, name, ...) name |
| Get an overloaded macro for 1 or 2 arguments. | |
| #define | hi_unreachable() std::terminate() |
| #define | hi_assume(condition) static_assert(sizeof(condition) == 1) |
| #define | hi_force_inline inline |
| #define | hi_no_inline |
| #define | hi_restrict |
| #define | hi_warning_push() |
| #define | hi_warning_pop() |
| #define | hi_msvc_pragma(a) |
| #define | hi_warning_ignore_clang(a) |
| #define | msvc_pragma(a) |
| #define | hi_typename |
| #define | ssizeof(x) (static_cast<ssize_t>(sizeof(x))) |
Typedefs | |
| using | hi::v1::ssize_t = std::ptrdiff_t |
| Signed size/index into an array. | |
Functions | |
| hi_warning_ignore_msvc (26472) | |
| hi_warning_ignore_msvc (26473) | |
| constexpr std::size_t | hi::v1::operator""_uz (unsigned long long lhs) noexcept |
| constexpr std::size_t | hi::v1::operator""_zu (unsigned long long lhs) noexcept |
| constexpr std::ptrdiff_t | hi::v1::operator""_z (unsigned long long lhs) noexcept |
| template<typename T , typename U > | |
| bool | hi::v1::compare_store (T &lhs, U &&rhs) noexcept |
| Compare then store if there was a change. | |
| template<typename T , typename U > | |
| bool | hi::v1::compare_store (std::atomic< T > &lhs, U &&rhs) noexcept |
| Compare then store if there was a change. | |
| template<class T , class U > | |
| constexpr auto && | hi::v1::forward_like (U &&x) noexcept |
Utilities used by the HikoGUI library itself.
This file includes required definitions.
| #define hi_expand | ( | ... | ) | hi_expand4(hi_expand4(hi_expand4(hi_expand4(__VA_ARGS__)))) |
Re-evaluate text up to 256 times by the pre-processor.
| ... | The text which needs to be re-evaluated by the pre-processor. |
| #define hi_for_each | ( | macro, | |
| ... ) __VA_OPT__(hi_expand(hi_for_each_helper(macro, __VA_ARGS__))) |
Evaluate a macro for each argument.
| macro | A macro that accepts a single argument. |
| ... | A set of arguments to be passed one-by-one to macro. |
| #define hi_forward | ( | x | ) | std::forward<decltype(x)>(x) |
Forward a value, based on the decltype of the value.
| #define hi_get_overloaded_macro2 | ( | _1, | |
| _2, | |||
| name, | |||
| ... ) name |
Get an overloaded macro for 1 or 2 arguments.
This macro allows dispatching to other macros based on the number of arguments.
| #define hi_num_va_args | ( | ... | ) |
Get the number of arguments.
| ... | A set of arguments |
| #define hi_return_if_valid | ( | expression | ) |
Return the result of an expression if the expression is valid.
This macro uses a requires {} expression to determine if the expression is valid.
| expression | The expression to evaluate if it is valid. |
| #define hi_return_on_self_assignment | ( | other | ) |
| #define hilet auto const |
Invariant should be the default for variables.
C++ does have an invariant but it requires you to enter the 'const' keyword which is easy to forget. Using a single keyword 'hilet' for an invariant makes it easier to notice when you have defined a variant.
| hi_warning_ignore_msvc | ( | 26472 | ) |
Get a bit from an array of unsigned integers. The integers are arranged in little-endian order.
| lhs | The array of integers from which to take the bit. |
| index | The index of the bit |
Set a bit from an array of unsigned integers. The integers are arranged in little-endian order.
| r | The array of integers on which to set the bit. |
| index | The index of the bit |
| value | The value of the bit, either 0 or 1. |
Shift logical left with carry chain.
| lhs | The original value |
| rhs | The count by how much to shift lhs left. |
| carry | The carry data to or with the lower bits. |
Shift logical right with carry chain.
| lhs | The original value |
| rhs | The count by how much to shift lhs right. |
| carry | The carry data to or with the lower bits. |
Shift arithmetic right with carry chain.
| lhs | The original value |
| rhs | The count by how much to shift lhs right. |
Add two numbers with carry chain.
| lhs | The left hand side |
| rhs | The right hand side |
| carry | From the previous add in the chain |
Multiply with carry. The carry is a high-word of the multiplication result and has the same size as the inputs. The accumulator is used when doing long-multiplication from the previous row. This function does not overflow even if all the arguments are at max.
| lhs | The left hand side. |
| rhs | The right hand side. |
| carry | The carry-input; carry-output from the previous mul_carry(). |
| accumulator | The column value during a long multiply. |
Wide divide. Can be used to divide a wide unsigned integer by a unsigned integer, as long as the result fits in an unsigned integer.
| lhs_lo | The low side of a wide left-hand-side |
| lhs_hi | The high side of a wide left-hand-side |
| rhs | The right hand side |
Bit scan reverse.
| lhs | The array of unsigned integers to find the highest set bit off. |
| n | The number of unsigned integers in the array. |
Invert unsigned integers using a carry-chain Technically this is not an carry chain.
| r | The result of the inversion. |
| rhs | The right hand side operand. |
| n | The number of digits of r and rhs. |
shift logical right using a carry-chain
| r | The result of the logical-shift-right. |
| lhs | The left hand side operand of the lsr. |
| rhs | The right hand side operand of the lsr, the number of bits to shift. |
| n | The number of digits of r, lhs and rhs. |
shift logical right using a carry-chain
| r | The result of the logical-shift-right. |
| lhs | The left hand side operand of the lsr. |
| rhs | The right hand side operand of the lsr, the number of bits to shift. |
| n | The number of digits of r, lhs and rhs. |
shift arithmetic right using a carry-chain This sign-extends the left most bit.
| r | The result of the logical-shift-right. |
| lhs | The left hand side operand of the lsr. |
| rhs | The right hand side operand of the lsr, the number of bits to shift. |
| n | The number of digits of r, lhs and rhs. |
and-operation unsigned integers using a carry-chain
| r | The result of the and-operation. |
| lhs | The left hand side operand of the and-operation. |
| rhs | The right hand side operand of the and-operation. |
| n | The number of digits of r, lhs and rhs. |
or-operation unsigned integers using a carry-chain
| r | The result of the and-operation. |
| lhs | The left hand side operand of the or-operation. |
| rhs | The right hand side operand of the or-operation. |
| n | The number of digits of r, lhs and rhs. |
xor-operation unsigned integers using a carry-chain
| r | The result of the and-operation. |
| lhs | The left hand side operand of the xor-operation. |
| rhs | The right hand side operand of the xor-operation. |
| n | The number of digits of r, lhs and rhs. |
Negate unsigned integers using a carry-chain This is a two's compliment negate.
| r | The result of the addition. |
| rhs | The left hand side operand of the addition. |
| n | The number of digits of r, lhs and rhs. |
Add unsigned integers using a carry-chain
| r | The result of the addition. |
| lhs | The left hand side operand of the addition. |
| rhs | The right hand side operand of the addition. |
| n | The number of digits of r, lhs and rhs. |
Subtract unsigned integers using a carry-chain
| r | The result of the addition. |
| lhs | The left hand side operand of the addition. |
| rhs | The right hand side operand of the addition. |
| n | The number of digits of r, lhs and rhs. |
Multiply unsigned integers using a carry-chain
| r | The result of the multiplication. |
| lhs | The left hand side operand. |
| rhs | The right hand side operand. |
| n | The number of digits of r, lhs and rhs. |
Divide unsigned integers using a carry-chain This function does a bit-wise division.
| quotient | The result of the division. |
| remainder | The remainder of the division. |
| lhs | The left hand side operand. |
| rhs | The right hand side operand. |
| n | The number of digits of quotient, remainder, lhs and rhs. |
signed divide unsigned integers using a carry-chain This function does a bit-wise division. This function will allocate memory when one or both operands are negative.
| quotient | The result of the division. |
| remainder | The remainder of the division. The remainder has same sign as lhs. |
| lhs | The left hand side operand. |
| rhs | The right hand side operand. |
| n | The number of digits of quotient, remainder, lhs and rhs. |