Gamp: jau Namespace Reference (original) (raw)
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros. More...
Classes
class
Persistent endian aware octet data, i.e. More...
class
Static compile-time string literal storage. More...
class
Simple statically sized bitfield template for efficient bit storage access. More...
class
Simple dynamically heap-sized bitheap for efficient bit storage access. More...
class
Call on release allows the user to pass a function to be called at destruction of this instance. More...
struct
A simple allocator using POSIX C functions: ::malloc(), ::free() and ::realloc(). More...
struct
A simple secure allocator for integral types using POSIX C functions: ::malloc() and ::free(). More...
struct
Performance counter std::allocator specialization. More...
struct
Performance counter jau::callocator specialization. More...
class
Implementation of a Copy-On-Write (CoW) using jau::darray as the underlying storage, exposing lock-free read operations using SC-DRF atomic synchronization. More...
class
Implementation of a Copy-On-Write (CoW) read-onlu iterator over immutable value_type storage. More...
class
Implementation of a Copy-On-Write (CoW) read-write iterator over mutable value_type storage. More...
class
Implementation of a Copy-On-Write (CoW) using std::vector as the underlying storage, exposing lock-free read operations using SC-DRF atomic synchronization. More...
class
Implementation of a dynamic linear array storage, aka vector, including relative positional access. More...
class
Extension to darray resulting in a sorted darray via insert(). More...
class
Main jau environment class, supporting environment variable access and fetching elapsed time using its stored startup-time. More...
class
class
Class template jau::function is a general-purpose static-polymorphic function wrapper. More...
struct
struct
struct
struct
float_bytes< sizeof(long double)>
class
struct
Simple pre-defined value pair [fraction_i64, size_t, bool] for structured bindings to multi-values. More...
class
Fraction template type using integral values, evaluated at runtime. More...
struct
Timespec structure using int64_t for its components in analogy to struct timespec_t on 64-bit platforms. More...
class
Class template jau::function is a general-purpose static-polymorphic function wrapper. More...
struct
Convenience type trait for __has_builtin(__builtin_bit_cast). More...
struct
A big-endian type trait for convenience . More...
struct
A little-endian type trait for convenience . More...
struct
struct
struct
Checker for member of pointer '->' operator with convertible pointer return, no arguments. More...
struct
class
HashMapWrap, generic std::unordered_map exposing a more higher level API. More...
class
class
class
struct
Simple pre-defined value tuple [int64_t, size_t, bool] for structured bindings to multi-values. More...
class
class
class
struct
is_container_memmove_compliant
template< class T > is_container_memmove_compliant<T>::value compile-time Type Trait, determining whether the given template class claims to be container memmove compliant, see @Ref darray_memmove. More...
struct
is_container_memmove_compliant< T, std::void_t< typename T::container_memmove_compliant > >
template< class T > is_container_memmove_compliant<T>::value compile-time Type Trait, determining whether the given template class claims to be container memmove compliant, see @Ref darray_memmove. More...
struct
template< class T > is_cow_type<T>::value compile-time Type Trait, determining whether the given template class is a CoW type, e.g. More...
struct
is_cow_type< T, std::void_t< typename T::cow_container_t > >
template< class T > is_cow_type<T>::value compile-time Type Trait, determining whether the given template class is a CoW type, e.g. More...
struct
template< class T > [is_darray_type](structjau%5F1%5F1is%5F%5Fdarray%5F%5Ftype.html "template< class T > is_darray_type<T>::value compile-time Type Trait, determining whether the given t...")<T>::value compile-time Type Trait, determining whether the given template class is a - or has a darray type, e.g. More...
struct
is_darray_type< T, std::void_t< typename T::darray_tag > >
template< class T > [is_darray_type](structjau%5F1%5F1is%5F%5Fdarray%5F%5Ftype.html "template< class T > is_darray_type<T>::value compile-time Type Trait, determining whether the given t...")<T>::value compile-time Type Trait, determining whether the given template class is a - or has a darray type, e.g. More...
struct
template< class T > is_enforcing_secmem<T>::value compile-time Type Trait, determining whether the given template class enforces secmem, see @Ref darray_secmem. More...
struct
is_enforcing_secmem< T, std::void_t< typename T::enforce_secmem > >
template< class T > is_enforcing_secmem<T>::value compile-time Type Trait, determining whether the given template class enforces secmem, see @Ref darray_secmem. More...
struct
Template type trait evaluating std::true_type{} if RTTI is available, otherwise std::false_type{}. More...
class
Inspired by std::latch of C++20. More...
class
class
class
class
class
struct
std::atomic type with predefined fixed std::memory_order, not allowing changing the memory model on usage and applying the set order to all operator. More...
class
struct
Support aligned memory transfer from and to potentially unaligned memory. More...
class
Persistent endian aware octet data, i.e. More...
class
class
Ring buffer implementation, a.k.a circular buffer, exposing lock-free [get*(..)](classjau%5F1%5F1ringbuffer.html#a4be8f532485065af5f5e53d447974715) and put*(..) methods. More...
class
Base jau environment class, merely to tag all environment settings by inheritance and hence documentation. More...
class
class
class
class
class
This class provides a RAII-style Sequentially Consistent (SC) data race free (DRF) critical block. More...
class
Service runner, a reusable dedicated thread performing custom user services. More...
class
A simple timer for timeout and interval applications, using one dedicated service_runner thread per instance. More...
struct
struct
struct
struct
struct
struct
Simple pre-defined value pair [size_t, bool] for structured bindings to multi-values. More...
class
struct
C++20: Heterogeneous Lookup in (Un)ordered Containers. More...
class
Transient endian aware octet data, i.e. More...
class
Transient endian aware octet data slice, i.e. More...
class
Transient read only and endian aware octet data, i.e. More...
struct
Helper, allowing simple access to compile time typename and Type traits information, see jau::type_name_cue to setup typename's string representation. More...
class
Generic type information using either Runtime type information (RTTI) or Compile time type information (CTTI) More...
struct
A 128-bit packed uint8_t data array. More...
struct
A 196-bit packed uint8_t data array. More...
struct
A 256-bit packed uint8_t data array. More...
struct
Simple pre-defined value tuple [uint64_t, size_t, bool] for structured bindings to multi-values. More...
struct
Simple pre-defined value pair [uint8_t*, size_t, bool] for structured bindings to multi-values. More...
struct
struct
struct
struct
struct
class
class
class
class
class
Typedefs
template<size_t BitSize>
using
bitfield = bitfield_t<jau::nsize_t, BitSize>
Simple bitfield template for efficient bit storage access.
typedef jau::uint_bytes_t< sizeof(float64_t)>
typedef jau::function< bool(const std::exception &, const char *file, int line)>
Exception handler method, should return true if not consumed or deemed an error. Shall be noexcept itself.
template<typename... Ts>
using
first_type = std::tuple_element_t<0, std::tuple<Ts...>>
typedef float
typedef double
template
using
float_bytes_t = typename float_bytes::type
Alias template for float_bytes.
typedef jau::uint_bytes_t< sizeof(float)>
typedef fraction< int64_t >
fraction using int64_t as integral type
typedef fraction< uint64_t >
fraction using uint64_t as integral type
template<typename... Ts>
using
is_all_same = std::conjunction<std::is_same<first_type<Ts...>, Ts>...>
typedef uint_bytes_t< sizeof(unsigned long int)>
Natural 'size_t' alternative using uint<XX>_t with xx = sizeof(unsigned long int)*8 as its natural sized type, i.e.
typedef ordered_atomic< bool, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar boolean.
typedef ordered_atomic< jau::fraction_i64, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar jau::fraction_i64.
typedef ordered_atomic< jau::fraction_u64, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar jau::fraction_u64.
typedef ordered_atomic< int, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar integer.
typedef ordered_atomic< int16_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar int16_t.
typedef ordered_atomic< int32_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar int32_t.
typedef ordered_atomic< int64_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar int64_t.
typedef ordered_atomic< int8_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar int8_t.
typedef ordered_atomic< jau::nsize_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar jau::nsize_t.
typedef ordered_atomic< std::size_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar size_t.
typedef ordered_atomic< jau::snsize_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar jau::snsize_t.
typedef ordered_atomic< ssize_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar ssize_t.
typedef ordered_atomic< uint16_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar uint16_t.
typedef ordered_atomic< uint32_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar uint32_t.
typedef ordered_atomic< uint64_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar uint64_t.
typedef ordered_atomic< uint8_t, std::memory_order_relaxed >
Relaxed non-SC atomic integral scalar uint8_t.
typedef ordered_atomic< bool, std::memory_order_seq_cst >
SC atomic integral scalar boolean.
typedef ordered_atomic< jau::fraction_i64, std::memory_order_seq_cst >
SC atomic integral scalar jau::fraction_i64.
typedef ordered_atomic< jau::fraction_u64, std::memory_order_seq_cst >
SC atomic integral scalar jau::fraction_u64.
typedef ordered_atomic< int, std::memory_order_seq_cst >
SC atomic integral scalar integer.
typedef ordered_atomic< int16_t, std::memory_order_seq_cst >
SC atomic integral scalar int16_t.
typedef ordered_atomic< int32_t, std::memory_order_seq_cst >
SC atomic integral scalar int32_t.
typedef ordered_atomic< int64_t, std::memory_order_seq_cst >
SC atomic integral scalar int64_t.
typedef ordered_atomic< int8_t, std::memory_order_seq_cst >
SC atomic integral scalar int8_t.
typedef ordered_atomic< jau::nsize_t, std::memory_order_seq_cst >
SC atomic integral scalar jau::nsize_t.
typedef ordered_atomic< std::size_t, std::memory_order_seq_cst >
SC atomic integral scalar size_t.
typedef ordered_atomic< jau::snsize_t, std::memory_order_seq_cst >
SC atomic integral scalar jau::snsize_t.
typedef jau::ordered_atomic< ssize_t, std::memory_order_seq_cst >
SC atomic integral scalar ssize_t.
typedef ordered_atomic< uint16_t, std::memory_order_seq_cst >
SC atomic integral scalar uint16_t.
typedef ordered_atomic< uint32_t, std::memory_order_seq_cst >
SC atomic integral scalar uint32_t.
typedef ordered_atomic< uint64_t, std::memory_order_seq_cst >
SC atomic integral scalar uint64_t.
typedef ordered_atomic< uint8_t, std::memory_order_seq_cst >
SC atomic integral scalar uint8_t.
typedef float
Length in fractions of meter using float.
typedef float
Mass in fractions of kilograms using float.
typedef float
Speed in fractions of meter/seconds using float.
typedef float
Time in fractions of seconds using float.
template
using
sint_bytes_t = typename sint_bytes::type
Alias template for sint_bytes.
typedef sint_bytes_t< sizeof(long int)>
Natural 'ssize_t' alternative using int<XX>_t with xx = sizeof(long int)*8 as its natural sized type, i.e.
template
using
StringHashMap = std::unordered_map<std::string, T, string_hash, std::equal_to<>>
std::unordered_map using std::string key and heterogenous jau::string_hash functor
template<typename Value_type, typename Novalue_type, Novalue_type no_value>
using
StringHashMapWrap = HashMapWrap<std::string, Value_type, Novalue_type, no_value, jau::string_hash, std::string_view>
StringHashMapWrap, generic std::unordered_map exposing a more higher level API.
using
StringHashSet = std::unordered_set<std::string, string_hash, std::equal_to<>>
std::unordered_set using std::string key and heterogenous jau::string_hash functor
template<typename K, typename V>
using
StringlikeHashMap = std::unordered_map<K, V, jau::string_hash, std::equal_to<>>
std::unordered_map using K key and heterogenous jau::string_hash functor
template<size_t N>
using
StringLiteral = BasicStringLiteral<char, N>
template
using
StringViewHashMap = std::unordered_map<std::string_view, T, string_hash, std::equal_to<>>
std::unordered_map using std::string_view key and heterogenous jau::string_hash functor, use with care!
template<typename Value_type, typename Novalue_type, Novalue_type no_value>
using
StringViewHashMapWrap = HashMapWrap<std::string_view, Value_type, Novalue_type, no_value, jau::string_hash>
StringHashViewMapWrap, generic std::unordered_map exposing a more higher level API, use with care!
using
StringViewHashSet = std::unordered_set<std::string_view, string_hash, std::equal_to<>>
std::unordered_set using std::string_view key and heterogenous jau::string_hash functor, use with care!
typedef std::basic_ostream< uchar8_t >
typedef std::basic_string< uchar8_t >
typedef std::basic_string_view< uchar8_t >
typedef uint8_t
template
using
uint_bytes_t = typename uint_bytes::type
Alias template for uint_bytes.
template<size_t N>
using
WStringLiteral = BasicStringLiteral<wchar_t, N>
Enumerations
enum class
bit_order_t : bool { bit_order_t::lsb = false , bit_order_t::msb = true }
Bit order type, i.e. More...
enum class
Bool : bool { Bool::False = false , Bool::True = true }
Boolean type without implicit conversion, safe for function parameter. More...
enum class
endian_t : uint32_t {
endian_t::little = 0x41424344U , endian_t::big = 0x44434241U , endian_t::pdp = 0x43444142U , endian_t::honeywell = 0x42414443U ,
endian_t::undefined = 0x00000000U , endian_t::native = impl::get_host_order()
}
Endian identifier, indicating endianess of all scalar types. More...
enum class
lb_endian_t : uint32_t { lb_endian_t::little = static_cast<uint32_t>( endian_t::little ) , lb_endian_t::big = static_cast<uint32_t>( endian_t::big ) , lb_endian_t::native = static_cast<uint32_t>( endian_t::native ) }
Simplified reduced endian type only covering little- and big-endian. More...
enum class
LoUpCase : bool { LoUpCase::lower = false , LoUpCase::upper = true }
enum class
PrefixOpt : bool { PrefixOpt::none = false , PrefixOpt::prefix = true }
enum class
type_info_flags_t : uint16_t { type_info_flags_t::none = 0 , type_info_flags_t::obj = 1 << 0 , type_info_flags_t::sig = 1 << 1 }
enum class
TypeTraitGroup : uint8_t {
TypeTraitGroup::NONE = 0b00000000 , TypeTraitGroup::PRIMARY_TYPE_CAT = 0b00000001 , TypeTraitGroup::TYPE_PROPERTIES = 0b00000010 , TypeTraitGroup::COMPOSITE_TYPE_CAT = 0b00000100 ,
TypeTraitGroup::SUPPORTED_OPERATIONS = 0b00001000 , TypeTraitGroup::ALL = 0b11111111
}
Enumerating the different groups of type traits. More...
Functions
template<std::integral int_type>
constexpr fraction< int_type >
abs (const fraction< int_type > &rhs) noexcept
Returns the absolute fraction.
constexpr fraction_timespec
abs (const fraction_timespec &rhs) noexcept
Returns the absolute fraction_timespec.
abs (const mp::BigInt &x) noexcept
template<jau::req::signed_arithmetic T>
constexpr T
abs (const T x) noexcept
Returns the absolute value of an arithmetic number (w/ branching) in O(1)
template<std::integral T>
constexpr bool
add_overflow (const T a, const T b, T &res) noexcept
Integer overflow aware addition returning true if overflow occurred, otherwise false having the result stored in res.
template<std::floating_point T>
constexpr T
adeg_to_rad (const T arc_degree) noexcept
Converts arc-degree to radians.
template<std::floating_point T>
constexpr bool
almost_equal (const T &a, const T &b, int ulp=1, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true, if both floating point values are equal in the sense that their potential difference is less or equal epsilon * |a+b| * ulp, where |a+b| scales epsilon to the magnitude of used values.
std::string &
appendBitString (std::string &dest, const void *data, const nsize_t length, const bit_order_t bitOrder=bit_order_t::msb, const PrefixOpt prefix=PrefixOpt::prefix, size_t bit_len=0) noexcept
Appends a binary string representation of the given lsb-first byte values.
template<class value_type, std::enable_if_t< std::is_integral_v< value_type >, bool > = true>
std::string &
appendDecString (std::string &dest, const value_type &val, const char separator='\'', const uint32_t min_width=0) noexcept
Appends a decimal integer string representation of an integral integer value with given radix.
std::string &
appendHexString (std::string &dest, const uint8_t value, const LoUpCase capitalization=LoUpCase::lower) noexcept
Produce a hexadecimal string representation of the given byte value and appends it to the given string.
std::string &
appendHexString (std::string &dest, const void *data, const nsize_t length, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix) noexcept
Appends a hexadecimal string representation of the given lsb-first byte values.
template<std::integral value_type>
std::string &
appendIntString (std::string &dest, value_type val, const uint32_t radix, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix, const uint32_t min_width=0, const char separator=0, const char padding='0') noexcept
Appends an integer string representation of an integral integer value with given radix.
template<typename CharT, std::convertible_to< CharT >... Rest>
BasicStringLiteral (CharT, Rest...) -> BasicStringLiteral< CharT, 1+sizeof...(Rest)>
template<typename CharT, size_t O>
BasicStringLiteral (const CharT(&str)[O]) -> BasicStringLiteral< CharT, O - 1 >
template<jau::req::unsigned_integral T>
constexpr T
be_to_cpu (T const n) noexcept
constexpr uint128dp_t
be_to_cpu (uint128dp_t const &n) noexcept
constexpr uint192dp_t
be_to_cpu (uint192dp_t const &n) noexcept
constexpr uint256dp_t
be_to_cpu (uint256dp_t const &n) noexcept
template<typename R, typename I, typename... A>
jau::function< R(A...)>
bind_capref (I *data_ptr, R(*func)(I *, A...)) noexcept
Bind given data by passing the captured reference (pointer) to the value and non-void function to an anonymous function using func::capref_target_t.
template<typename I, typename... A>
jau::function< void(A...)>
bind_capref (I *data_ptr, void(*func)(I *, A...)) noexcept
Bind given data by passing the captured reference (pointer) to the value and void function to an anonymous function using func::capref_target_t.
template<typename R, typename I, typename... A>
jau::function< R(A...)>
bind_capval (const I &data, R(*func)(I &, A...)) noexcept
Bind given data by copying the captured value and the given non-void function to an anonymous function using func::capval_target_t.
template<typename I, typename... A>
jau::function< void(A...)>
bind_capval (const I &data, void(*func)(I &, A...)) noexcept
Bind given data by copying the captured value and the given void function to an anonymous function using func::capval_target_t.
template<typename R, typename I, typename... A>
jau::function< R(A...)>
bind_capval (I &&data, R(*func)(I &, A...)) noexcept
Bind given data by moving the captured value and copying the given non-void function to an anonymous function using func::capval_target_t.
template<typename I, typename... A>
jau::function< void(A...)>
bind_capval (I &&data, void(*func)(I &, A...)) noexcept
Bind given data by moving the captured value and copying the given void function to an anonymous function using func::capval_target_t.
template<typename R, typename... A>
jau::function< R(A...)>
bind_free (R(*func)(A...)) noexcept
Bind given non-void free-function to an anonymous function using func::free_target_t.
template<typename... A>
jau::function< void(A...)>
bind_free (void(*func)(A...)) noexcept
Bind given void free-function to an anonymous function using func::free_target_t.
template<typename R, typename C, typename... A>
jau::function< R(A...)>
bind_member (C *base, R(C::*mfunc)(A...)) noexcept
Bind given class instance and non-void member function to an anonymous function using func_member_targer_t.
template<typename C, typename... A>
jau::function< void(A...)>
bind_member (C *base, void(C::*mfunc)(A...)) noexcept
Bind given class instance and void member function to an anonymous function using func_member_targer_t.
template<typename R, typename C0, typename C1, typename... A>
jau::function< R(A...)>
bind_member (C1 *base, R(C0::*mfunc)(A...)) noexcept
Bind given class instance and non-void member function to an anonymous function using func_member_targer_t.
template<typename C0, typename C1, typename... A>
jau::function< void(A...)>
bind_member (C1 *base, void(C0::*mfunc)(A...)) noexcept
Bind given class instance and void member function to an anonymous function using func_member_targer_t.
template<typename R, typename... A>
jau::function< R(A...)>
bind_std (uint64_t id, std::function< R(A...)> func) noexcept
Bind given non-void std::function to an anonymous function using func::std_target_t.
template<typename... A>
jau::function< void(A...)>
bind_std (uint64_t id, std::function< void(A...)> func) noexcept
Bind given void std::function to an anonymous function using func::std_target_t.
template<class Dest, class Source>
constexpr std::enable_if_t< sizeof(Dest)==sizeof(Source) &&std::is_trivially_copyable_v< Dest > &&std::is_trivially_copyable_v< Source >, Dest >
bit_cast (const Source &src) noexcept
C++20 bit_cast<>(arg) implementation for C++17.
template<jau::req::unsigned_integral T>
constexpr T
bit_ceil (const T n) noexcept
If the given n is not is_power_of_2() return next_power_of_2(), otherwise return n unchanged.
template<jau::req::unsigned_integral T>
constexpr size_t
bit_count (T n) noexcept
Returns the number of set bits within given unsigned integral.
template<jau::req::unsigned_integral T>
static constexpr T
bit_mask (size_t n) noexcept
Returns the T bit mask of n-bits, i.e.
constexpr uint32_t
bit_value (const float a) noexcept
Returns the unsigned integer representation according to IEEE 754 (IEC 559) single floating-point bit layout.
constexpr uint64_t
bit_value (const float64_t a) noexcept
Returns the unsigned integer representation according to IEEE 754 (IEC 559) float64_t floating-point bit layout.
constexpr uint32_t
bit_value_raw (const float a) noexcept
Returns the unsigned integer representation according to IEEE 754 (IEC 559) single floating-point bit layout.
constexpr uint64_t
bit_value_raw (const float64_t a) noexcept
Returns the unsigned integer representation according to IEEE 754 (IEC 559) float64_t floating-point bit layout.
template<std::floating_point T>
jau::uint_bytes_t< sizeof(T)>
bit_value_raw (const T a) noexcept
Returns the unsigned integer representation according to IEEE 754 (IEC 559) floating-point bit layout.
template<jau::req::unsigned_integral T>
requires (sizeof(T) == 2)
constexpr T
bswap (T const &source) noexcept
template<jau::req::unsigned_integral T>
requires (sizeof(T) == 4)
constexpr T
bswap (T const &source) noexcept
template<jau::req::unsigned_integral T>
requires (sizeof(T) == 8)
constexpr T
bswap (T const &source) noexcept
constexpr uint128dp_t
bswap (uint128dp_t const &source) noexcept
constexpr uint192dp_t
bswap (uint192dp_t const &source) noexcept
constexpr uint256dp_t
bswap (uint256dp_t const &source) noexcept
constexpr void
bswap (uint8_t *sink, uint8_t const *source, nsize_t len)
template
void
callNotOptimize (UnaryFunc f) __attrdef_no_optimize__
Simple unary function wrapper which ensures function call to happen in order and not optimized away.
const uint8_t *
cast_char_ptr_to_uint8 (const char *s) noexcept
const char *
cast_uint8_ptr_to_char (const uint8_t *b) noexcept
char *
cast_uint8_ptr_to_char (uint8_t *b) noexcept
const mp::BigInt &
clamp (const mp::BigInt &x, const mp::BigInt &min_val, const mp::BigInt &max_val) noexcept
template<jau::req::arithmetic T>
constexpr T
clamp (const T x, const T min_val, const T max_val) noexcept
Returns constrained integral value to lie between given min- and maximum value (w/ branching) in O(1).
clamp (mp::BigInt &x, mp::BigInt &min_val, mp::BigInt &max_val) noexcept
template<jau::req::arithmetic R, jau::req::arithmetic T>
constexpr R
clampCast (const T x, const T min_val, const T max_val) noexcept
Returns constrained integral value to lie between given min- and maximum value (w/ branching) in O(1), cast to type R.
void
clear_bit_uint32 (const uint8_t nr, uint32_t &mask)
void
clear_bit_uint64 (const uint8_t nr, uint64_t &mask)
template<std::floating_point T>
constexpr int
compare (const T a, const T b) noexcept
Returns -1, 0 or 1 if a is less, equal or greater than b, disregarding epsilon but considering NaN, -Inf and +Inf.
template<std::floating_point T>
constexpr int
compare (const T a, const T b, const T epsilon) noexcept
Returns -1, 0 or 1 if a is less, equal or greater than b, considering epsilon and NaN, -Inf and +Inf.
consteval_cxx20 void
consteval_assert (bool v)
template<class InputArray, class T>
constexpr bool
contains (InputArray &array, const T &value) noexcept
Return true if value is contained in array.
template<jau::req::unsigned_integral T>
constexpr T
cpu_to_be (T const h) noexcept
constexpr uint128dp_t
cpu_to_be (uint128dp_t const &h) noexcept
constexpr uint192dp_t
cpu_to_be (uint192dp_t const &h) noexcept
constexpr uint256dp_t
cpu_to_be (uint256dp_t const &h) noexcept
template<jau::req::unsigned_integral T>
constexpr T
cpu_to_le (T const h) noexcept
constexpr uint128dp_t
cpu_to_le (uint128dp_t const &h) noexcept
constexpr uint192dp_t
cpu_to_le (uint192dp_t const &h) noexcept
constexpr uint256dp_t
cpu_to_le (uint256dp_t const &h) noexcept
template<jau::req::signed_integral T>
constexpr T
ct_abs (const T x) noexcept
Returns the absolute value of an arithmetic number (w/o branching) in O(1) and constant time (CT), while ct_abs(INT_MIN) is undefined behavior (UB) instead of being mapped correctly to INT_MAX like jau::abs() does, see above.
constexpr uint32_t
ct_bit_count (uint32_t n) noexcept
Returns the number of set bits within given 32bit integer (w/o branching) in O(1) and constant time (CT).
template<std::integral T>
constexpr T
ct_clamp (const T x, const T min_val, const T max_val) noexcept
Returns constrained integral value to lie between given min- and maximum value for MIN <= x - y <= MAX (w/o branching) in O(1) and constant time (CT).
template<jau::req::unsigned_integral T>
constexpr T
ct_expand_top_bit (T x)
Returns ~0 (2-complement) if top bit of arg is set, otherwise 0 (w/o branching) in O(1) and constant time (CT).
template<jau::req::unsigned_integral T>
constexpr T
ct_is_zero (T x)
Returns ~0 (2-complement) if arg is zero, otherwise 0 (w/o branching) in O(1) and constant time (CT).
template<jau::req::unsigned_integral T>
constexpr T
ct_masked_merge (T mask, T a_if_masked, T b_if_unmasked) noexcept
Returns merged a_if_masked bits selected by mask 1 bits and b_if_unmasked bits selected by mask 0 bits (w/o branching) in O(1) and constant time (CT).
template<std::integral T>
constexpr T
ct_max (const T x, const T y) noexcept
Returns the maximum of two integrals for MIN <= x - y <= MAX (w/o branching) in O(1) and constant time (CT).
template<std::integral T>
constexpr T
ct_min (const T x, const T y) noexcept
Returns the minimum of two integrals for MIN <= x - y <= MAX (w/o branching) in O(1) and constant time (CT).
constexpr uint32_t
ct_next_power_of_2 (uint32_t n) noexcept
Returns the next higher power of 2 of given unsigned 32-bit n (w/o branching) in O(1) and constant time (CT).
constexpr uint64_t
ct_next_power_of_2 (uint64_t n) noexcept
template<std::integral T>
constexpr int
ct_sign (const T x) noexcept
Returns the value of the sign function (w/o branching) in O(1) and constant time (CT)
template
constexpr const char *
ctti_name () noexcept
Returns the type name of given type T using template Compile Time Type Information (CTTI) only with static constant storage duration.
template<typename R, typename L, typename... A>
constexpr const char *
ctti_name () noexcept
Returns the type name of given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only with static constant storage duration.
std::string
demangle_name (const char *mangled_name) noexcept
Returns the demangled given mangled_name if successful, otherwise the mangled_name.
std::string
dfa_utf8_decode (const uint8_t *buffer, const size_t buffer_size)
Returns all valid consecutive UTF-8 characters within buffer in the range up to buffer_size or until EOS.
uint32_t
dfa_utf8_decode (uint32_t &state, uint32_t &codep, const uint32_t byte_value)
constexpr int32_t
digit (const uint8_t c, const uint32_t radix=10) noexcept
Returns digit value of given char c matching the radix 16, 10, 8 or 2, -1 on no match.
template<jau::req::unsigned_integral T>
constexpr uint32_t
digits (const T x, const uint32_t radix) noexcept
Returns the number of digits of the given unsigned integral value number and the given radix.
template<jau::req::signed_integral T>
constexpr uint32_t
digits10 (const T x) noexcept
Returns the number of decimal digits of the given signed integral value number using std::log10() including a negative sign of value x as a digit.
template<std::integral T>
constexpr uint32_t
digits10 (const T x, const bool sign_is_digit) noexcept
Returns the number of decimal digits of the given integral value number using std::log10().
template<std::integral T>
constexpr uint32_t
digits10 (const T x, const int x_sign, const bool sign_is_digit=true) noexcept
Returns the number of decimal digits of the given integral value number using std::log10().
template
bool
do_noexcept (UnaryPredicate p) noexcept
No throw wrap for given unary predicate p action. Returns true for success (no exception), otherwise false (exception occurred).
constexpr float64_t
double_value (const uint64_t a) noexcept
Converting IEEE 754 (IEC 559) float64_t floating-point bit layout to float64_t, see bit_value()
template<std::integral T>
constexpr bool
equals (const T &a, const T &b) noexcept
Returns true if both values are equal.
template<std::floating_point T>
constexpr bool
equals (const T &a, const T &b, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true if both values are equal, i.e.
template<std::floating_point T>
constexpr bool
equals (const T &a, const T &b, int ulp, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true, if both floating point values are equal in the sense that their potential difference is less or equal epsilon * ulp.
template<std::floating_point T>
constexpr bool
equals2 (const T &a, const T &b, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true if both values are equal, i.e.
template<std::floating_point T>
constexpr bool
equals_raw (const T &a, const T &b) noexcept
Returns true if both values are equal disregarding epsilon but considering NaN, -Inf and +Inf.
template<class InputArray, class T>
constexpr bool
eraseFirst (InputArray &array, const T &value)
constexpr uint32_t
exponent_raw (float32_t a) noexcept
Extracts the 8-bit exponent from the given IEEE 754 (IEC 559) float32_t.
constexpr uint32_t
exponent_raw (float64_t a) noexcept
Extracts the 11-bit exponent from the given IEEE 754 (IEC 559) float64_t.
constexpr int32_t
exponent_unbiased (float32_t a) noexcept
Extracts the unbiased 8-bit exponent from the given IEEE 754 (IEC 559) float64_t and subtracts 127, i.e.
constexpr int32_t
exponent_unbiased (float64_t a) noexcept
Extracts the unbiased 11-bit exponent from the given IEEE 754 (IEC 559) float64_t and subtracts 1023, i.e.
constexpr Bool
False () noexcept
template<class InputIt, class T>
constexpr InputIt
find (InputIt first, InputIt last, const T &value) noexcept
Like std::find() of 'algorithm'.
template
const T::value_type *
find_const (T &data, typename T::value_type const &elem, std::enable_if_t< < T >::value, bool >=true) noexcept
template
const T::value_type *
find_const (T &data, typename T::value_type const &elem, std::enable_if_t< is_cow_type< T >::value, bool >=true) noexcept
template<class InputIt, class UnaryPredicate>
constexpr InputIt
find_if (InputIt first, InputIt last, UnaryPredicate p) noexcept
Like std::find_if() of 'algorithm'.
template<class InputIt, class UnaryPredicate>
constexpr InputIt
find_if_not (InputIt first, InputIt last, UnaryPredicate q) noexcept
Like std::find_if_not() of 'algorithm'.
constexpr float
float_value (const uint32_t a) noexcept
Converting IEEE 754 (IEC 559) single floating-point bit layout to float, see bit_value()
template<class InputIt, class UnaryFunction>
constexpr UnaryFunction
for_each (InputIt first, InputIt last, UnaryFunction f)
Like std::for_each() of 'algorithm'.
template<class T, class UnaryFunction>
constexpr UnaryFunction
for_each_const (T &data, UnaryFunction f, std::enable_if_t< < T >::value, bool >=true) noexcept
template<class T, class UnaryFunction>
constexpr UnaryFunction
for_each_const (T &data, UnaryFunction f, std::enable_if_t< is_cow_type< T >::value, bool >=true) noexcept
template<class InputIt, class UnaryFunction>
constexpr UnaryFunction
for_each_fidelity (InputIt first, InputIt last, UnaryFunction f)
Like jau::for_each(), see above.
template<class T, class UnaryFunction>
constexpr UnaryFunction
for_each_fidelity (T &data, UnaryFunction f, std::enable_if_t< < T >::value, bool >=true) noexcept
template<class T, class UnaryFunction>
constexpr UnaryFunction
for_each_fidelity (T &data, UnaryFunction f, std::enable_if_t< is_cow_type< T >::value, bool >=true) noexcept
template<class InputArray, class UnaryFunction>
constexpr UnaryFunction
for_each_idx (InputArray &array, UnaryFunction f)
Custom for_each template, using indices instead of iterators, allowing container to be modified within lambda 'callback'.
template<class Mutex, class InputArray, class UnaryFunction>
constexpr UnaryFunction
for_each_idx_mtx (Mutex &mtx, InputArray &array, UnaryFunction f)
Custom for_each template, same as jau::for_each but using indices instead of iterators and a mutex.
template<class Mutex, class InputIt, class UnaryFunction>
constexpr UnaryFunction
for_each_mtx (Mutex &mtx, InputIt first, InputIt last, UnaryFunction f)
Custom for_each template, same as jau::for_each but using a mutex.
template<typename... Args>
std::string
format_string (std::string_view fmt, const Args &...args) noexcept
Safely returns a (non-truncated) string according to snprintf() formatting rules using a reserved string length of jau::cfmt::default_string_capacity and variable number of arguments following the fmt argument.
template<typename... Args>
std::string
format_string_h (const std::size_t strLenHint, std::string_view fmt, const Args &...args) noexcept
Safely returns a (non-truncated) string according to snprintf() formatting rules and variable number of arguments following the fmt argument.
template<typename... Args>
std::string
format_string_hn (const std::size_t strLenHint, const std::size_t maxLen, std::string_view fmt, const Args &...args) noexcept
Safely returns a (potentially truncated) string according to snprintf() formatting rules and variable number of arguments following the fmt argument.
template<typename... Args>
std::string
format_string_n (const std::size_t maxLen, std::string_view fmt, const Args &...args) noexcept
Safely returns a (potentially truncated) string according to snprintf() formatting rules and variable number of arguments following the fmt argument.
template<typename... Args>
ssize_t
fprintf_sc (FILE *stream, std::string_view format, const Args &...args) noexcept
Convenient secure fprintf() invocation using jau:format_string.
template<typename... Args>
ssize_t
fprintf_td (const uint64_t elapsed_ms, FILE *stream, std::string_view format, const Args &...args) noexcept
Convenient secure fprintf() invocation, prepending the given elapsed_ms timestamp and using jau:format_string.
template<typename... Args>
ssize_t
fprintf_td (FILE *stream, std::string_view format, const Args &...args) noexcept
Convenient secure fprintf() invocation, prepending the environment::getElapsedMillisecond() timestamp, and using jau:format_string.
fromBitString (std::string_view const bitstr, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True) noexcept
Converts a given binary string representation into a uint64_t value according to bitStringBytes().
fromBitString (std::vector< uint8_t > &out, const std::string_view bitstr, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True)
See fromBitString()
fromBitString (std::vector< uint8_t > &out, const uint8_t bitstr[], const size_t bitstr_len, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True)
Converts a given binary string representation, appending to a byte vector (lsb-first).
fromBitString (uint8_t *out, size_t out_len, const std::string_view bitstr, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True) noexcept
See fromBitString()
fromBitString (uint8_t *out, size_t out_len, const uint8_t bitstr[], const size_t bitstr_len, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True) noexcept
Converts a given binary string representation, storing into a byte array(lsb-first).
fromHexString (std::string_view const hexstr, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True) noexcept
Converts a given hexadecimal string representation appending to a uint64_t value according to hexStringBytes().
fromHexString (std::vector< uint8_t > &out, const std::string_view hexstr, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True)
See hexStringBytes()
fromHexString (std::vector< uint8_t > &out, const uint8_t hexstr[], const size_t hexstr_len, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True)
Converts a given hexadecimal string representation, appending to a byte vector (lsb-first).
fromHexString (uint8_t *out, size_t out_len, const std::string_view hexstr, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True) noexcept
See hexStringBytes()
fromHexString (uint8_t *out, size_t out_len, const uint8_t hexstr[], const size_t hexstr_len, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True) noexcept
Converts a given hexadecimal string representation, storing into a byte array(lsb-first).
template<std::integral value_type>
constexpr SizeBoolPair
fromIntString (value_type &result, const char *str, size_t str_len, uint32_t radix=10, const char separator=0) noexcept
See fromIntString.
template<std::integral value_type>
constexpr SizeBoolPair
fromIntString (value_type &result, std::string_view str, uint32_t radix=10, const char separator=0) noexcept
Converts a given integer string representation to the given result reference, compatible with ::strtoll()
gcd (const mp::BigInt &a, const mp::BigInt &b) noexcept
template<jau::req::signed_integral T>
constexpr T
gcd (T a, T b) noexcept
Returns the greatest common divisor (GCD) of the two given integer values following Euclid's algorithm from Euclid's Elements ~300 BC, using the absolute positive value of given integers.
std::string
get_backtrace (const bool skip_anon_frames, const jau::snsize_t max_frames=-1, const jau::snsize_t skip_frames=1) noexcept
Returns a de-mangled backtrace string separated by newline excluding this function.
constexpr int16_t
get_int16 (uint8_t const *buffer) noexcept
Returns a int16_t value from the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr int16_t
get_int16 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
Returns a int16_t value from the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr int32_t
get_int32 (uint8_t const *buffer) noexcept
See get_int16() for reference.
constexpr int32_t
get_int32 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
See get_int16() for reference.
constexpr int64_t
get_int64 (uint8_t const *buffer) noexcept
See get_int16() for reference.
constexpr int64_t
get_int64 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
See get_int16() for reference.
constexpr int8_t
get_int8 (uint8_t const *buffer) noexcept
template
constexpr T
get_packed_value (const packed_t< T > *source, const lb_endian_t byte_order) noexcept
Return packed_t::store after converting it to from either lb_endian::little or lb_endian::big depending on given byte_order to lb_endian::native.
std::string
get_string (const uint8_t *buffer, nsize_t const buffer_len, nsize_t const max_len)
Returns a C++ String taken from buffer with maximum length of min(max_len, max_len).
constexpr uint128dp_t
get_uint128 (uint8_t const *buffer) noexcept
See get_uint16() for reference.
constexpr uint128dp_t
get_uint128 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
See get_uint16() for reference.
constexpr uint16_t
get_uint16 (uint8_t const *buffer) noexcept
Returns a uint16_t value from the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr uint16_t
get_uint16 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
Returns a uint16_t value from the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr uint192dp_t
get_uint192 (uint8_t const *buffer) noexcept
See get_uint16() for reference.
constexpr uint192dp_t
get_uint192 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
See get_uint16() for reference.
constexpr uint256dp_t
get_uint256 (uint8_t const *buffer) noexcept
See get_uint16() for reference.
constexpr uint256dp_t
get_uint256 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
See get_uint16() for reference.
constexpr uint32_t
get_uint32 (uint8_t const *buffer) noexcept
See get_uint16() for reference.
constexpr uint32_t
get_uint32 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
See get_uint16() for reference.
constexpr uint64_t
get_uint64 (uint8_t const *buffer) noexcept
See get_uint16() for reference.
constexpr uint64_t
get_uint64 (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
See get_uint16() for reference.
constexpr uint8_t
get_uint8 (uint8_t const *buffer) noexcept
get_uuid128 (uint8_t const *buffer) noexcept
get_uuid128 (uint8_t const *buffer, lb_endian_t const le_or_be) noexcept
get_uuid16 (uint8_t const *buffer) noexcept
get_uuid16 (uint8_t const *buffer, lb_endian_t const le_or_be) noexcept
get_uuid32 (uint8_t const *buffer) noexcept
get_uuid32 (uint8_t const *buffer, lb_endian_t const le_or_be) noexcept
template
constexpr std::enable_if_t< std::is_standard_layout_v< T >, T >
get_value (uint8_t const *buffer) noexcept
Returns a T value from the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
template
constexpr std::enable_if_t< std::is_standard_layout_v< T >, T >
get_value (uint8_t const *buffer, const lb_endian_t byte_order) noexcept
Returns a T value from the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
uint64_t
getCurrentMilliseconds () noexcept
Returns current monotonic time in milliseconds.
getMonotonicTime () noexcept
Returns current monotonic time since Unix Epoch 00:00:00 UTC on 1970-01-01.
uint64_t
getWallClockSeconds () noexcept
Returns current wall-clock system time of day in seconds since Unix Epoch 00:00:00 UTC on 1 January 1970.
getWallClockTime () noexcept
Returns current wall-clock real-time since Unix Epoch 00:00:00 UTC on 1970-01-01.
bool
handle_exception (std::exception_ptr eptr, const char *file, int line) noexcept
Handle given optional exception (nullable std::exception_ptr) and send std::exception::what() message to stderr
bool
handle_exception (std::exception_ptr eptr, jau::exception_handler_t &eh, const char *file, int line) noexcept
Handle given optional exception (nullable std::exception_ptr) and calls exception_handler_t.
consteval_cxx20 bool
has_builtin_add_overflow () noexcept
Query whether __builtin_add_overflow is available via __has_builtin(__builtin_add_overflow).
consteval_cxx20 bool
has_builtin_bit_cast () noexcept
Query whether __builtin_bit_cast(Dest_type, arg) is available via __has_builtin(__builtin_bit_cast).
consteval_cxx20 bool
has_builtin_mul_overflow () noexcept
Query whether __builtin_mul_overflow is available via __has_builtin(__builtin_mul_overflow).
consteval_cxx20 bool
has_builtin_sub_overflow () noexcept
Query whether __builtin_sub_overflow is available via __has_builtin(__builtin_sub_overflow).
constexpr int32_t
hexDigit (const uint8_t c) noexcept
template<jau::req::unsigned_integral T>
constexpr nsize_t
high_bit (T x)
Return the index of the highest set bit w/ branching (loop) in O(n/2).
template<jau::req::arithmetic T>
bool
in_range (const T &a, const T &b, const T &range)
base_math: arithmetic types, i.e.
template<jau::req::signed_arithmetic T>
constexpr T
invert_sign (const T x) noexcept
Safely inverts the sign of an arithmetic number w/ branching in O(1)
bool
is_ascii_code (int c) noexcept
constexpr bool
is_big_endian () noexcept
Evaluates true if platform is running in big endian mode, i.e.
consteval_cxx20 bool
is_builtin_int128_available () noexcept
consteval_cxx20 bool
is_cxx17 () noexcept
Returns true if compiled with >= C++17.
consteval_cxx20 bool
is_cxx20 () noexcept
Returns true if compiled with >= C++20.
consteval_cxx20 bool
is_cxx23 () noexcept
Returns true if compiled with >= C++23.
consteval_cxx20 bool
is_cxx26 () noexcept
Returns true if compiled with >= C++26.
consteval_cxx20 bool
is_debug_enabled () noexcept
Returns true if compiled with debug information and w/o optimization, i.e.
constexpr bool
is_defined_endian (const endian_t &v) noexcept
Evaluates true if the given endian is defined, i.e.
constexpr bool
is_digit (const char c, const uint32_t radix=10, const char separator=0) noexcept
Returns true if given char c matches the char symbol range with the radix 16, 10 (default), 8 or 2.
constexpr bool
is_little_endian () noexcept
Evaluates true if platform is running in little endian mode, i.e.
constexpr bool
is_little_endian (const endian_t byte_order) noexcept
Returns true if given byte_order equals endian::little, otherwise false.
constexpr bool
is_little_endian (const lb_endian_t byte_order) noexcept
Returns true if given byte_order equals lb_endian::little, otherwise false.
constexpr bool
is_little_or_big_endian () noexcept
Evaluates true if platform is running in little or big endian mode, i.e.
template
requires jau::req::signed_integral
constexpr bool
is_positive (const T a) noexcept
Returns true of the given integral is positive, i.e.
template
requires std::floating_point
constexpr bool
is_positive (const T a) noexcept
template
requires jau::req::unsigned_integral
constexpr bool
is_positive (const T) noexcept
template<jau::req::unsigned_integral T>
constexpr bool
is_power_of_2 (const T x) noexcept
Power of 2 test in O(1), i.e.
consteval_cxx20 bool
is_rtti_available () noexcept
Returns true if compiled with RTTI available.
constexpr bool
is_space (const char c) noexcept
Returns true if given char c is one of the following whitespace character:
template<std::integral T>
constexpr bool
is_zero (const T &a) noexcept
base_math: arithmetic types, i.e.
template<std::floating_point T>
constexpr bool
is_zero (const T &a, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true if the given value is less than epsilon, w/ epsilon > 0.
template<std::floating_point T>
constexpr bool
is_zero2f (const T &a, const T &b, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true if all given values a and b are less than epsilon, w/ epsilon > 0.
template<std::floating_point T>
constexpr bool
is_zero3f (const T &a, const T &b, const T &c, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true if all given values a, b and c are less than epsilon, w/ epsilon > 0.
template<std::floating_point T>
constexpr bool
is_zero4f (const T &a, const T &b, const T &c, const T &d, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
Returns true if all given values a, b, c and d are less than epsilon, w/ epsilon > 0.
template<std::floating_point T>
constexpr bool
is_zero_raw (const T &a) noexcept
Returns true if the given value is zero, disregarding epsilon but considering NaN, -Inf and +Inf.
constexpr bool
isTypeTraitBitSet (const TypeTraitGroup mask, const TypeTraitGroup bit) noexcept
JAU_MAKE_BITFIELD_ENUM_STRING (type_info_flags_t, obj, sig)
template<std::integral T>
constexpr bool
lcm_overflow (const T a, const T b, T &result) noexcept
Integer overflow aware calculation of least common multiple (LCM) following Euclid's algorithm from Euclid's Elements ~300 BC.
template<jau::req::unsigned_integral T>
constexpr T
le_to_cpu (T const l) noexcept
constexpr uint128dp_t
le_to_cpu (uint128dp_t const &l) noexcept
constexpr uint192dp_t
le_to_cpu (uint192dp_t const &l) noexcept
constexpr uint256dp_t
le_to_cpu (uint256dp_t const &l) noexcept
constexpr size_t
log2_byteshift (const size_t bytesize) noexcept
Returns log2(bytesize*8), e.g.
template<std::floating_point T>
T
machineEpsilon () noexcept
Calculates the smallest floating point value approximation the given type T can represent, the machine epsilon of T.
template<typename First, typename... Next>
constexpr cow_darray< First >
make_cow_darray (First &&arg1)
Complement constructor for cow_darray instance, move semantics initializer for one argument.
template<typename First, typename... Next, std::enable_if_t< std::conjunction_v< std::is_same< First, Next >... >, bool > = true>
constexpr cow_darray< First >
make_cow_darray (First &&arg1, Next &&... argsN)
Construct a cow_darray instance, initialized by move semantics from the variadic (template pack) argument list.
template
make_ctti (bool identity_instance=false) noexcept
Constructs a jau::type_info instance based on given type T using template Compile Time Type Information (CTTI) only.
template<typename R, typename L, typename... A>
make_ctti (bool identity_instance=false) noexcept
Constructs a jau::type_info instance based on given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only via RTTI's `typeid(L) if available or jau::ctti_name<R, L, A...>() otherwise.
template<typename First, typename... Next>
constexpr darray< First >
make_darray (First &&arg1)
Complement constructor for darray instance, move semantics initializer for one argument.
template<typename First, typename... Next, std::enable_if_t< std::conjunction_v< std::is_same< First, Next >... >, bool > = true>
constexpr darray< First >
make_darray (First &&arg1, Next &&... argsN)
Construct a darray instance, initialized by move semantics from the variadic (template pack) argument list.
constexpr Bool
makeBool (bool v) noexcept
template<std::floating_point T>
std::string &
mat_to_string (std::string &sb, const std::string &rowPrefix, const std::string_view f, const T a[], const jau::nsize_t rows, const jau::nsize_t columns, const bool rowMajorOrder) noexcept
Appends a matrix of floating points to the given string sb
template<std::integral int_type>
constexpr const fraction< int_type > &
max (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
Return the maximum of the two given fractions.
constexpr const fraction_timespec &
max (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
Return the maximum of the two given fraction_timespec.
const mp::BigInt &
max (const mp::BigInt &x, const mp::BigInt &y) noexcept
template<jau::req::arithmetic T>
constexpr T
max (const T x, const T y) noexcept
Returns the maximum of two integrals (w/ branching) in O(1)
template<std::integral int_type>
constexpr const fraction< int_type > &
max (fraction< int_type > &&, fraction< int_type > &&) noexcept=delete
constexpr const fraction_timespec &
max (fraction_timespec &&, fraction_timespec &&) noexcept=delete
const mp::BigInt &
max (mp::BigInt &&, mp::BigInt &&) noexcept=delete
max (mp::BigInt &x, mp::BigInt &y) noexcept
merge_uint128 (uint16_t const uuid16, uint128dp_t const &base_uuid, nsize_t const uuid16_le_octet_index)
Merge the given 'uuid16' into a 'base_uuid' copy at the given little endian 'uuid16_le_octet_index' position.
merge_uint128 (uint32_t const uuid32, uint128dp_t const &base_uuid, nsize_t const uuid32_le_octet_index)
Merge the given 'uuid32' into a 'base_uuid' copy at the given little endian 'uuid32_le_octet_index' position.
bool
milli_sleep (uint64_t td_ms, const bool ignore_irq=true) noexcept
millisecond sleep using high precision monotonic timer, useful for one-shot delays (only).
template<std::integral int_type>
constexpr const fraction< int_type > &
min (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
Return the minimum of the two given fractions.
constexpr const fraction_timespec &
min (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
Return the minimum of the two given fraction_timespec.
const mp::BigInt &
min (const mp::BigInt &x, const mp::BigInt &y) noexcept
template<jau::req::arithmetic T>
constexpr T
min (const T x, const T y) noexcept
Returns the minimum of two integrals (w/ branching) in O(1)
template<std::integral int_type>
constexpr const fraction< int_type > &
min (fraction< int_type > &&, fraction< int_type > &&) noexcept=delete
constexpr const fraction_timespec &
min (fraction_timespec &&, fraction_timespec &&) noexcept=delete
const mp::BigInt &
min (mp::BigInt &&, mp::BigInt &&) noexcept=delete
min (mp::BigInt &x, mp::BigInt &y) noexcept
template<std::integral T>
constexpr bool
mul_overflow (const T a, const T b, T &res) noexcept
Integer overflow aware multiplication returning true if overflow occurred, otherwise false having the result stored in res.
constexpr std::string_view
constexpr uint32_t
number (const func::target_type rhs) noexcept
constexpr uint8_t
number (const TypeTraitGroup rhs) noexcept
constexpr Bool
operator! (const Bool rhs) noexcept
template<class T1, class T2>
bool
operator!= (const callocator< T1 > &lhs, const callocator< T2 > &rhs) noexcept
template<class T1, class T2>
bool
operator!= (const callocator_sec< T1 > &lhs, const callocator_sec< T2 > &rhs) noexcept
template<class T1, class T2>
bool
operator!= (const counting_allocator< T1 > &lhs, const counting_allocator< T2 > &rhs) noexcept
template<class T1, class T2>
bool
operator!= (const counting_callocator< T1 > &lhs, const counting_callocator< T2 > &rhs) noexcept
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator!= (const cow_darray< Value_type, Size_type, Alloc_type > &rhs, const cow_darray< Value_type, Size_type, Alloc_type > &lhs)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator!= (const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator!= (const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Value_type, typename Alloc_type>
bool
operator!= (const cow_vector< Value_type, Alloc_type > &rhs, const cow_vector< Value_type, Alloc_type > &lhs)
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator!= (const darray< Value_type, Size_type, Alloc_type > &rhs, const darray< Value_type, Size_type, Alloc_type > &lhs)
template<std::integral int_type>
constexpr bool
operator!= (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
template<class R, class... A>
bool
operator!= (const function< R(A...)> &lhs, std::nullptr_t) noexcept
Unequal operator of jau::function<R(A...)> with a right-hand-side nullptr.
template<typename Rl, typename... Al, template< typename... > typename Fl = function, typename Rr, typename... Ar, template< typename... > typename Fr = function>
bool
operator!= (const function< Rl(Al...)> &lhs, const function< Rr(Ar...)> &rhs) noexcept
Unequal operator using two jau::function<R(A...)> types for both arguments.
constexpr bool
operator!= (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
template<class R, class... A>
bool
operator!= (std::nullptr_t, const function< R(A...)> &rhs) noexcept
Unequal operator of jau::function<R(A...)> with a left-hand-side nullptr.
constexpr Bool
operator& (const Bool lhs, const Bool rhs) noexcept
constexpr TypeTraitGroup
operator& (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
constexpr Bool
operator&& (const Bool lhs, const Bool rhs) noexcept
constexpr Bool &
operator&= (Bool &lhs, const Bool rhs) noexcept
constexpr bool
operator* (const Bool rhs) noexcept
template<std::integral int_type>
constexpr fraction< int_type >
operator* (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
Returns product of two fraction.
template<std::integral int_type>
constexpr fraction< int_type >
operator* (const fraction< int_type > &lhs, const int_type &rhs) noexcept
Returns multiplication of fraction with scalar.
constexpr fraction_timespec
operator* (const fraction_timespec &lhs, const int64_t rhs) noexcept
Returns product of fraction_timespec * scalar.
constexpr fraction_timespec
operator* (const int64_t lhs, const fraction_timespec &rhs) noexcept
Returns product of scalar * fraction_timespec.
template<std::integral int_type>
constexpr fraction< int_type >
operator* (const int_type &lhs, const fraction< int_type > &rhs) noexcept
Returns multiplication of fraction with scalar.
template<typename CharT, std::size_t N, std::size_t O>
constexpr BasicStringLiteral< CharT, N+O-1 >
operator+ (const BasicStringLiteral< CharT, N > &lhs, const char(&rhs)[O])
template<typename CharT, size_t O, std::size_t N>
constexpr BasicStringLiteral< CharT, N+O-1 >
operator+ (const char(&lhs)[O], const BasicStringLiteral< CharT, N > rhs)
template<std::integral int_type>
constexpr fraction< int_type >
operator+ (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
Returns sum of two fraction.
constexpr fraction_timespec
operator+ (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
Returns sum of two fraction_timespec.
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr Storage_type::difference_type
operator- (const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr Storage_type::difference_type
operator- (const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<std::integral int_type>
constexpr fraction< int_type >
operator- (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
Returns difference of two fraction.
constexpr fraction_timespec
operator- (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
Returns difference of two fraction_timespec.
template<std::integral int_type>
constexpr fraction< int_type >
operator/ (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
Returns division of two fraction.
template<std::integral int_type>
constexpr fraction< int_type >
operator/ (const fraction< int_type > &lhs, const int_type &rhs) noexcept
Returns division of fraction with scalar.
constexpr fraction_timespec
operator/ (const fraction_timespec &lhs, const int64_t rhs) noexcept
Returns fraction of fraction_timespec / scalar.
constexpr fraction_timespec
operator/ (const int64_t lhs, const fraction_timespec &rhs) noexcept
Returns fraction of scalar / fraction_timespec.
template<std::integral int_type>
constexpr fraction< int_type >
operator/ (const int_type &lhs, const fraction< int_type > &rhs) noexcept
Returns division of fraction with scalar.
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator< (const cow_darray< Value_type, Size_type, Alloc_type > &rhs, const cow_darray< Value_type, Size_type, Alloc_type > &lhs)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator< (const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator< (const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Value_type, typename Alloc_type>
bool
operator< (const cow_vector< Value_type, Alloc_type > &rhs, const cow_vector< Value_type, Alloc_type > &lhs)
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator< (const darray< Value_type, Size_type, Alloc_type > &rhs, const darray< Value_type, Size_type, Alloc_type > &lhs)
template<std::integral int_type>
constexpr bool
operator< (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
template<jau::req::unsigned_integral StorageType, size_t BitSize>
requires requires (StorageType) { sizeof(StorageType) <= sizeof(size_t); }
std::ostream &
operator<< (std::ostream &out, const bitfield_t< StorageType, BitSize > &v)
std::ostream &
operator<< (std::ostream &out, const bitheap &v)
std::ostream &
operator<< (std::ostream &out, const Bool c)
template<typename Value_type, typename Size_type, typename Alloc_type>
std::ostream &
operator<< (std::ostream &out, const cow_darray< Value_type, Size_type, Alloc_type > &c)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
std::ostream &
operator<< (std::ostream &out, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &c)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
std::ostream &
operator<< (std::ostream &out, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &c)
template<typename Value_type, typename Alloc_type>
std::ostream &
operator<< (std::ostream &out, const cow_vector< Value_type, Alloc_type > &c)
template<typename Value_type, typename Size_type, typename Alloc_type>
std::ostream &
operator<< (std::ostream &out, const darray< Value_type, Size_type, Alloc_type > &c)
std::ostream &
operator<< (std::ostream &out, const type_info &v)
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator<= (const cow_darray< Value_type, Size_type, Alloc_type > &rhs, const cow_darray< Value_type, Size_type, Alloc_type > &lhs)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator<= (const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator<= (const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Value_type, typename Alloc_type>
bool
operator<= (const cow_vector< Value_type, Alloc_type > &rhs, const cow_vector< Value_type, Alloc_type > &lhs)
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator<= (const darray< Value_type, Size_type, Alloc_type > &rhs, const darray< Value_type, Size_type, Alloc_type > &lhs)
template<std::integral int_type>
constexpr bool
operator<= (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
constexpr bool
operator== (const Bool lhs, const Bool rhs) noexcept
template<class T1, class T2>
bool
operator== (const callocator< T1 > &lhs, const callocator< T2 > &rhs) noexcept
template<class T1, class T2>
bool
operator== (const callocator_sec< T1 > &lhs, const callocator_sec< T2 > &rhs) noexcept
template<class T1, class T2>
bool
operator== (const counting_allocator< T1 > &lhs, const counting_allocator< T2 > &rhs) noexcept
template<class T1, class T2>
bool
operator== (const counting_callocator< T1 > &lhs, const counting_callocator< T2 > &rhs) noexcept
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator== (const cow_darray< Value_type, Size_type, Alloc_type > &rhs, const cow_darray< Value_type, Size_type, Alloc_type > &lhs)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator== (const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator== (const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Value_type, typename Alloc_type>
bool
operator== (const cow_vector< Value_type, Alloc_type > &rhs, const cow_vector< Value_type, Alloc_type > &lhs)
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator== (const darray< Value_type, Size_type, Alloc_type > &rhs, const darray< Value_type, Size_type, Alloc_type > &lhs)
template<std::integral int_type>
constexpr bool
operator== (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
template<class R, class... A>
bool
operator== (const function< R(A...)> &lhs, std::nullptr_t) noexcept
Equal operator of jau::function<R(A...)> with a right-hand-side nullptr.
template<typename Rl, typename... Al, template< typename... > class Fl = function, typename Rr, typename... Ar, template< typename... > class Fr = function, std::enable_if_t< !std::is_same_v< Fl< Rl(Al...)>, Fr< Rr(Ar...)> >, bool > = true>
bool
operator== (const function< Rl(Al...)> &lhs, const function< Rr(Ar...)> &rhs) noexcept
Equal operator using different jau::function<R(A...)> return and argument types for both arguments, always returns false.
constexpr bool
operator== (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
template<class R, class... A>
bool
operator== (std::nullptr_t, const function< R(A...)> &rhs) noexcept
Equal operator of jau::function<R(A...)> with a left-hand-side nullptr.
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator> (const cow_darray< Value_type, Size_type, Alloc_type > &rhs, const cow_darray< Value_type, Size_type, Alloc_type > &lhs)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator> (const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator> (const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Value_type, typename Alloc_type>
bool
operator> (const cow_vector< Value_type, Alloc_type > &rhs, const cow_vector< Value_type, Alloc_type > &lhs)
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator> (const darray< Value_type, Size_type, Alloc_type > &rhs, const darray< Value_type, Size_type, Alloc_type > &lhs)
template<std::integral int_type>
constexpr bool
operator> (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator>= (const cow_darray< Value_type, Size_type, Alloc_type > &rhs, const cow_darray< Value_type, Size_type, Alloc_type > &lhs)
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator>= (const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Storage_type, typename Storage_ref_type, typename CoW_container>
constexpr bool
operator>= (const cow_rw_iterator< Storage_type, Storage_ref_type, CoW_container > &lhs, const cow_ro_iterator< Storage_type, Storage_ref_type, CoW_container > &rhs) noexcept
template<typename Value_type, typename Alloc_type>
bool
operator>= (const cow_vector< Value_type, Alloc_type > &rhs, const cow_vector< Value_type, Alloc_type > &lhs)
template<typename Value_type, typename Size_type, typename Alloc_type>
bool
operator>= (const darray< Value_type, Size_type, Alloc_type > &rhs, const darray< Value_type, Size_type, Alloc_type > &lhs)
template<std::integral int_type>
constexpr bool
operator>= (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
constexpr Bool
operator^ (const Bool lhs, const Bool rhs) noexcept
constexpr TypeTraitGroup
operator^ (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
constexpr Bool &
operator^= (Bool &lhs, const Bool rhs) noexcept
constexpr Bool
operator| (const Bool lhs, const Bool rhs) noexcept
constexpr TypeTraitGroup
operator| (const TypeTraitGroup lhs, const TypeTraitGroup rhs) noexcept
constexpr Bool &
operator|= (Bool &lhs, const Bool rhs) noexcept
constexpr Bool
operator|| (const Bool lhs, const Bool rhs) noexcept
template<class Dest, class Source>
constexpr std::enable_if_t< sizeof(Dest)==sizeof(Source) &&std::is_pointer_v< Source > &&std::is_pointer_v< Dest >, Dest >
pointer_cast (const Source &src) noexcept
A constexpr pointer cast implementation for C++17, inspired by C++20 bit_cast<>(arg).
pow (mp::BigInt b, const mp::BigInt &e)
void
print_backtrace (const bool skip_anon_frames, const jau::snsize_t max_frames=-1, const jau::snsize_t skip_frames=2) noexcept
Prints the de-mangled backtrace string separated by newline excluding this function to stderr, using get_backtrace().
template
void
printSharedPtrList (const std::string &prefix, List &list) noexcept
constexpr void
put_int16 (uint8_t *buffer, const int16_t v) noexcept
Put the given int16_t value into the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr void
put_int16 (uint8_t *buffer, const int16_t v, const lb_endian_t byte_order) noexcept
Put the given uint16_t value into the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr void
put_int32 (uint8_t *buffer, const int32_t v) noexcept
See put_int16() for reference.
constexpr void
put_int32 (uint8_t *buffer, const int32_t v, const lb_endian_t byte_order) noexcept
See put_int16() for reference.
constexpr void
put_int64 (uint8_t *buffer, const int64_t &v) noexcept
See put_int16() for reference.
constexpr void
put_int64 (uint8_t *buffer, const int64_t &v, const lb_endian_t byte_order) noexcept
See put_int16() for reference.
constexpr void
put_uint128 (uint8_t *buffer, const uint128dp_t &v) noexcept
See put_uint16() for reference.
constexpr void
put_uint128 (uint8_t *buffer, const uint128dp_t &v, const lb_endian_t byte_order) noexcept
See put_uint16() for reference.
constexpr void
put_uint16 (uint8_t *buffer, const uint16_t v) noexcept
Put the given uint16_t value into the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr void
put_uint16 (uint8_t *buffer, const uint16_t v, const lb_endian_t byte_order) noexcept
Put the given uint16_t value into the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
constexpr void
put_uint192 (uint8_t *buffer, const uint192dp_t &v) noexcept
See put_uint16() for reference.
constexpr void
put_uint192 (uint8_t *buffer, const uint192dp_t &v, const lb_endian_t byte_order) noexcept
See put_uint16() for reference.
constexpr void
put_uint256 (uint8_t *buffer, const uint256dp_t &v) noexcept
See put_uint16() for reference.
constexpr void
put_uint256 (uint8_t *buffer, const uint256dp_t &v, const lb_endian_t byte_order) noexcept
See put_uint16() for reference.
constexpr void
put_uint32 (uint8_t *buffer, const uint32_t v) noexcept
See put_uint16() for reference.
constexpr void
put_uint32 (uint8_t *buffer, const uint32_t v, const lb_endian_t byte_order) noexcept
See put_uint16() for reference.
constexpr void
put_uint64 (uint8_t *buffer, const uint64_t &v) noexcept
See put_uint16() for reference.
constexpr void
put_uint64 (uint8_t *buffer, const uint64_t &v, const lb_endian_t byte_order) noexcept
See put_uint16() for reference.
constexpr void
put_uint8 (uint8_t *buffer, const uint8_t v) noexcept
template
constexpr std::enable_if_t< std::is_standard_layout_v< T >, void >
put_value (uint8_t *buffer, const T &v) noexcept
Put the given T value into the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
template
constexpr std::enable_if_t< std::is_standard_layout_v< T >, void >
put_value (uint8_t *buffer, const T &v, const lb_endian_t byte_order) noexcept
Put the given T value into the given byte address using packed_t to resolve a potential memory alignment issue free of costs.
template<std::floating_point T>
constexpr T
rad_to_adeg (const T rad) noexcept
Converts radians to arc-degree.
template<class ForwardIt, class T>
ForwardIt
remove (ForwardIt first, ForwardIt last, const T &value)
Identical to C++20 std::remove() of algorithm
template<class ForwardIt, class UnaryPredicate>
ForwardIt
remove_if (ForwardIt first, ForwardIt last, UnaryPredicate p)
Identical to C++20 std::remove_if() of algorithm
template<jau::req::unsigned_integral T>
constexpr T
rev_bits (jau::nsize_t n, T v)
Reversed n bits of value v, this is an O(n) operation.
constexpr uint16_t
rev_bits (uint16_t v) noexcept
Reverse bits of two bytes.
constexpr uint32_t
rev_bits (uint32_t v) noexcept
Reverse bits of four bytes.
constexpr uint64_t
rev_bits (uint64_t v) noexcept
Reverse bits of eight bytes.
constexpr uint8_t
rev_bits (uint8_t v) noexcept
Reverse bits of one byte.
template<jau::req::unsigned_integral T, jau::req::unsigned_integral U>
constexpr T
round_down (T n, U align_to)
Round down w/ branching in O(1)
template<std::floating_point T>
constexpr jau::sint_bytes_t< sizeof(T)>
round_to_int (const T v) noexcept
Returns the rounded value cast to signed int.
template<std::floating_point T>
constexpr jau::uint_bytes_t< sizeof(T)>
round_to_uint (const T v) noexcept
Returns the rounded value cast to unsigned int.
template<jau::req::unsigned_integral T, jau::req::unsigned_integral U>
constexpr T
round_up (const T n, const U align_to)
Round up w/ branching in O(1)
template<std::floating_point T>
std::string &
row_to_string (std::string &sb, const std::string_view f, const T a[], const jau::nsize_t rows, const jau::nsize_t columns, const bool rowMajorOrder, const jau::nsize_t row) noexcept
Appends a row of floating points to the given string sb
void
set_bit_uint32 (const uint8_t nr, uint32_t &mask)
void
set_bit_uint64 (const uint8_t nr, uint64_t &mask)
template<std::integral int_type>
constexpr snsize_t
sign (const fraction< int_type > &rhs) noexcept
Returns the value of the sign function applied to numerator.
constexpr snsize_t
sign (const fraction_timespec &rhs) noexcept
Returns the value of the sign function applied to tv_sec.
template<jau::req::signed_arithmetic T>
constexpr int
sign (const T x) noexcept
Returns the value of the sign function (w/o branching ?) in O(1).
constexpr uint32_t
significand_raw (float32_t a) noexcept
Extracts the 23-bit significand (fraction, mantissa) from the given IEEE 754 (IEC 559) float32_t.
constexpr uint64_t
significand_raw (float64_t a) noexcept
Extracts the 52-bit significand (fraction, mantissa) from the given IEEE 754 (IEC 559) float64_t.
bool
sleep (const fraction_timespec &relative_time, const bool ignore_irq=true) noexcept
sleep using high precision monotonic timer, useful for one-shot delays (only).
bool
sleep_for (const fraction_i64 &relative_time, const bool monotonic=true, const bool ignore_irq=true) noexcept
sleep_for causes the current thread to block until a specific amount of time has passed.
bool
sleep_for (const fraction_timespec &relative_time, const bool monotonic=true, const bool ignore_irq=true) noexcept
sleep_for causes the current thread to block until a specific amount of time has passed.
bool
sleep_until (const fraction_timespec &absolute_time, const bool monotonic=true, const bool ignore_irq=true) noexcept
sleep_until causes the current thread to block until the specific time is reached.
std::vector< std::string >
split_string (const std::string &str, const std::string &separator)
Split given string str at separator into the resulting std::vector excluding the separator sequence .
template
const jau::type_info &
static_ctti () noexcept
Returns a static global reference of make_ctti(true) w/ identity instance.
template<typename R, typename L, typename... A>
const jau::type_info &
static_ctti () noexcept
Returns a static global reference of make_ctti<R, L, A...>(true) w/ identity instance.
std::string
string_noexcept (std::string_view v) noexcept
No throw std::string(std::string_view) instantiation.
template
std::string
string_noexcept (UnaryPredicate p) noexcept
No throw wrap for given unary predicate p producing a std::string. Returns an empty string if p causes an exception.
template<std::integral T>
constexpr bool
sub_overflow (const T a, const T b, T &res) noexcept
Integer overflow aware subtraction returning true if overflow occurred, otherwise false having the result stored in res.
template<typename Value_type, typename Size_type, typename Alloc_type>
void
swap (cow_darray< Value_type, Size_type, Alloc_type > &rhs, cow_darray< Value_type, Size_type, Alloc_type > &lhs) noexcept
template<typename Value_type, typename Alloc_type>
void
swap (cow_vector< Value_type, Alloc_type > &rhs, cow_vector< Value_type, Alloc_type > &lhs) noexcept
template<typename Value_type, typename Size_type, typename Alloc_type>
void
swap (darray< Value_type, Size_type, Alloc_type > &rhs, darray< Value_type, Size_type, Alloc_type > &lhs) noexcept
uint32_t
test_bit_uint32 (const uint8_t nr, const uint32_t mask)
uint64_t
test_bit_uint64 (const uint8_t nr, const uint64_t mask)
std::string
threadName (const std::thread::id id) noexcept
template<class value_type, std::enable_if_t< std::is_integral_v< value_type >, bool > = true>
std::string
to_decstring (const value_type &v, const char separator='\'', const nsize_t min_width=0) noexcept
Produces a decimal integer string representation of an integral integer value with given radix.
constexpr endian_t
to_endian (const lb_endian_t v) noexcept
to_fraction_i64 (std::string_view str, const fraction_i64 &min_allowed, const fraction_i64 &max_allowed) noexcept
Returns the fraction_i64 of the given character in format <num>/<denom>, which may contain whitespace.
constexpr lb_endian_t
to_lb_endian (const endian_t v) noexcept
std::string
to_string (const bit_order_t v) noexcept
Return std::string representation of the given bit_order_t.
std::string
to_string (const Bool v) noexcept
template<typename CharT, std::size_t N>
constexpr std::string
to_string (const CharT(&ref)[N])
std::string_view
to_string (const endian_t v) noexcept
Return std::string representation of the given endian.
template<std::integral int_type>
std::string
to_string (const fraction< int_type > &v) noexcept
std::string
to_string (const fraction_timespec &v) noexcept
std::string_view
to_string (const func::target_type v) noexcept
std::string_view
to_string (const lb_endian_t v) noexcept
Return std::string representation of the given lb_endian.
template<typename _Tp, std::memory_order _MO>
std::string
to_string (const ordered_atomic< _Tp, _MO > &ref)
std::string
to_string (const uuid_t::TypeSize v) noexcept
template<class value_type>
requires std::is_same_v<jau::StringLiteral<value_type::size>, value_type>
constexpr std::string
to_string (const value_type &ref)
template<class value_type, std::enable_if_t<(std::is_integral_v< value_type > &&!std::is_same_v< bool, std::remove_cv_t< value_type > >)||std::is_floating_point_v< value_type >, bool > = true>
std::string
to_string (const value_type &ref)
template
std::string
to_string (std::vector< T > const &list)
template
std::string
to_string (std::vector< T > const &list, const nsize_t radix)
template
std::string
to_string (std::vector< T > const &list, const std::string &delim)
template
std::string
to_string (std::vector< T > const &list, const std::string &delim, const nsize_t radix)
template<std::integral value_type>
std::string
to_string (value_type v, const uint32_t radix, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix, const uint32_t min_width=0, const char separator=0, const char padding='0') noexcept
Produces an integer string representation of an integral integer value with given radix.
template<class uint8_container_type>
requires jau::req::contiguous_container<uint8_container_type> && std::convertible_to<typename uint8_container_type::value_type, uint8_t>
std::string
toBitString (const uint8_container_type &bytes, const bit_order_t bitOrder=bit_order_t::msb, const PrefixOpt prefix=PrefixOpt::prefix, size_t bit_len=0) noexcept
Produce a binary string representation with leading 0b in MSB of the given uint8_t continuous container values.
std::string
toBitString (const void *data, const nsize_t length, const bit_order_t bitOrder=bit_order_t::msb, const PrefixOpt prefix=PrefixOpt::prefix, size_t bit_len=0) noexcept
Produce a binary string representation of the given lsb-first byte values.
template<class value_type>
requires jau::req::standard_layout<value_type> && jau::req::trivially_copyable<value_type> && (<value_type>) && (
<value_type>)
std::string
toBitString (value_type const &v, const bit_order_t bitOrder=bit_order_t::msb, const PrefixOpt prefix=PrefixOpt::prefix, size_t bit_len=0) noexcept
Produce a binary string representation with leading 0b in MSB of the given value with standard layout.
template<class uint8_container_type>
requires jau::req::contiguous_container<uint8_container_type> && std::convertible_to<typename uint8_container_type::value_type, uint8_t>
std::string
toHexString (const uint8_container_type &bytes, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt skipPrefix=PrefixOpt::prefix) noexcept
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given uint8_t continuous container values.
std::string
toHexString (const void *data, const nsize_t length, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix) noexcept
Produce a hexadecimal string representation of the given lsb-first byte values.
template<class value_type>
requires jau::req::pointer<value_type> && (<value_type>)
std::string
toHexString (value_type const &v, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix) noexcept
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given pointer.
template<class value_type>
requires jau::req::standard_layout<value_type> && jau::req::trivially_copyable<value_type> && (<value_type>) && (
<value_type>)
std::string
toHexString (value_type const &v, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix) noexcept
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given value with standard layout.
std::string
toLower (const std::string &s)
std::string &
toLowerInPlace (std::string &s) noexcept
std::string
trim (const std::string &s)
trim copy
void
trimInPlace (std::string &s) noexcept
trim in place
constexpr Bool
True () noexcept
template
const char *
type_name () noexcept
Returns the type name of given type T using template Compile Time Type Information (CTTI) only via RTTI's typeid(T).[name()](group%5F%5FCppLang.html#gacf64608c3055658d14e0aa014d56ab15) if available or jau::ctti_name() otherwise.
template<typename R, typename L, typename... A>
const char *
type_name () noexcept
Returns the type name of given function types R(*L)(A...) using template Compile Time Type Information (CTTI) only via RTTI's typeid(L).[name()](group%5F%5FCppLang.html#gacf64608c3055658d14e0aa014d56ab15) if available or jau::ctti_name<R, L, A...>() otherwise.
template<jau::req::signed_arithmetic T>
constexpr std::make_unsigned_t< T >
unsigned_value (const T x) noexcept
Returns the unsigned typed absolute value of an arithmetic number (w/ branching) in O(1)
template<jau::req::unsigned_arithmetic T>
constexpr T
unsigned_value (const T x) noexcept
constexpr bool
value (const Bool rhs) noexcept
std::cv_status
wait_for (std::condition_variable &cv, std::unique_lock< std::mutex > &lock, const fraction_i64 &relative_time, const bool monotonic=true) noexcept
wait_for causes the current thread to block until the condition variable is notified, a specific amount of time has passed, or a spurious wakeup occurs.
std::cv_status
wait_for (std::condition_variable &cv, std::unique_lock< std::mutex > &lock, const fraction_timespec &relative_time, const bool monotonic=true) noexcept
wait_for causes the current thread to block until the condition variable is notified, a specific amount of time has passed, or a spurious wakeup occurs.
std::cv_status
wait_until (std::condition_variable &cv, std::unique_lock< std::mutex > &lock, const fraction_timespec &absolute_time, const bool monotonic=true) noexcept
wait_until causes the current thread to block until the condition variable is notified, a specific time is reached, or a spurious wakeup occurs.
void
zero_bytes_sec (void *s, size_t n) noexcept __attrdecl_no_optimize__
Wrapper to ::explicit_bzero(), ::bzero() or ::memset(), whichever is available in that order.
Variables
Bluetooth UUID https://www.bluetooth.com/specifications/assigned-numbers/service-discovery/
static constexpr const uint32_t
DFA_UTF8_ACCEPT = 0
static constexpr const uint32_t
DFA_UTF8_REJECT = 12
constexpr uint64_t const
double_iec559_exp_mask = 0x7ff0000000000000_u64
Exponent mask bits 52-62 of IEEE 754 (IEC 559) double double-point bit layout, i.e.
constexpr uint64_t const
double_iec559_mant_mask = 0x000fffffffffffff_u64
Mantissa mask bits 0-51 of IEEE 754 (IEC 559) double double-point bit layout, i.e.
constexpr uint64_t const
double_iec559_nan_bitval = 0x7ff8000000000000_u64
NaN bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e.
constexpr uint64_t const
double_iec559_negative_inf_bitval = 0xfff0000000000000_u64
Negative infinity bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e.
constexpr uint64_t const
double_iec559_positive_inf_bitval = 0x7ff0000000000000_u64
Positive infinity bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e.
constexpr uint64_t const
double_iec559_sign_bit = 1_u64 << 63
Signed bit 63 of IEEE 754 (IEC 559) double double-point bit layout, i.e.
template<std::floating_point T>
constexpr T
EPSILON = std::numeric_limits::epsilon()
Alias for epsilon constant, i.e. std::numeric_limits::epsilon()
constexpr uint32_t const
float_iec559_exp_mask = 0x7f800000_u32
Exponent mask bits 23-30 of IEEE 754 (IEC 559) single float-point bit layout, i.e.
constexpr uint32_t const
float_iec559_mant_mask = 0x007fffff_u32
Mantissa mask bits 0-22 of IEEE 754 (IEC 559) single float-point bit layout, i.e.
constexpr uint32_t const
float_iec559_nan_bitval = 0x7fc00000_u32
NaN bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e.
constexpr uint32_t const
float_iec559_negative_inf_bitval = 0xff800000_u32
Negative infinity bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e.
constexpr uint32_t const
float_iec559_positive_inf_bitval = 0x7f800000_u32
Positive infinity bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e.
constexpr uint32_t const
float_iec559_sign_bit = 1_u32 << 31
Signed bit 31 of IEEE 754 (IEC 559) single float-point bit layout, i.e.
template<typename Dummy_type>
constexpr bool
has_builtin_bit_cast_v = has_builtin_bit_cast_t<Dummy_type>::value
Value access of has_builtin_bit_cast type trait for convenience .
template<typename Dummy_type>
constexpr bool
has_endian_big_v = has_endian_big<Dummy_type>::value
Value access of big-endian type trait for convenience .
template<typename Dummy_type>
constexpr bool
has_endian_little_v = has_endian_little<Dummy_type>::value
Value access of little-endian type trait for convenience .
template<typename _Tp>
constexpr bool
has_free_to_string_v = has_free_to_string<_Tp>::value
template<typename _Tp>
constexpr bool
has_member_of_pointer_v = has_member_of_pointer<_Tp>::value
template<typename _Tp>
constexpr bool
has_to_string_v = has_to_string<_Tp>::value
template<typename _Tp>
constexpr bool
has_toString_v = has_toString<_Tp>::value
constexpr const char *
HexadecimalArrayBig = "0123456789ABCDEF"
constexpr const char *
HexadecimalArrayLow = "0123456789abcdef"
template<std::floating_point T>
constexpr T
inv_PI = std:🔢:inv_pi_v
Alias for 1/π or inverse of π, i.e. T(1)/std:🔢:pi_v or std:🔢:inv_pi_v
template<typename... Ts>
constexpr bool
is_all_same_v = is_all_same<Ts...>::value
template
constexpr bool
is_container_memmove_compliant_v = is_container_memmove_compliant::value
template
constexpr bool
is_enforcing_secmem_v = is_enforcing_secmem::value
template<typename _Dummy>
constexpr bool
is_rtti_available_v = is_rtti_available_t<_Dummy>::value
Template type trait helper evaluating true if RTTI is available, otherwise false.
template<std::floating_point T>
constexpr T
PI = std:🔢:pi_v
Alias for π or half-circle radians (180 degrees), i.e. std:🔢:pi_v
template<std::floating_point T>
constexpr T
PI_2 = std:🔢:pi_v/T(2)
Alias for π/2 or right-angle radians (90 degrees), i.e. std:🔢:pi_v/T(2)
template<std::floating_point T>
constexpr T
PI_4 = std:🔢:pi_v/T(4)
Alias for π/4 or half right-angle radians (45 degrees), i.e. std:🔢:pi_v/T(4)
const jau::util::VersionNumberString
const char *
const char *
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.