aboutsummaryrefslogtreecommitdiffstats
path: root/include/jau
Commit message (Collapse)AuthorAgeFilesLines
* Fix macro header name (to be included once)Sven Göthel2024-04-1516-47/+51
|
* int_types: Add template-arg type float_bytes<>, allowing to meta-prog ↵Sven Göthel2024-04-151-0/+5
| | | | matching float type based on size
* math: extract arithmetic types, i.e. integral + floating point types to ↵Sven Göthel2024-04-153-169/+287
| | | | | | | | | | | | | | | | | | | base_math.hpp, cleaning up int_math.hpp and float_math.hpp float_math.hpp: - Using std::is_floating_point_v<T> instead of !std::numeric_limits<T>::is_integer - round_to_int() returns `typename jau::sint_bytes<sizeof(T)>::type`, i.e. proper integer-sized type - row_to_string() + mat_to_string() definition in header and using template floating point type int_math.hpp: - Adding equals() w/ integration template type, complementing the floating point type variant -
* cpp_lang_util: Add constexpr_cxx23 and constexpr_cxx26; Add doc-comment re ↵Sven Göthel2024-04-151-0/+27
| | | | used C++ version macro __cplusplus and compiler-id macros
* math: Mat4f: Add get{Column|Row} w/o passing result storage; Add ↵Sven Göthel2024-04-131-1/+41
| | | | operator*(const Vec4f&)
* math: Quaternion: Simplify toEuler(); Make toMatrix() const; Add ↵Sven Göthel2024-04-131-12/+20
| | | | toMatrix(Mat4f&)
* math: Vec*f: Add bulk get(float []); Add Vec3f::set(const Vec4f&)Sven Göthel2024-04-133-0/+29
|
* math: Quaternion: Use operator overloading for +=, -= and *= and +, -, *; ↵Sven Göthel2024-04-131-48/+65
| | | | Drop passing temporaries as they are very cheap in native land; Add test_math_quaternion (WIP)
* math: Quaternion::set() must be constexprSven Göthel2024-04-131-1/+1
|
* math: Fix Quaternion::dot(): typo w -> m_wSven Göthel2024-04-131-1/+1
|
* math: Fix vec3f::angle() [add const]; test_math_vec: Add Vec3f angle tests ↵Sven Göthel2024-04-131-1/+1
| | | | via acos(dot(..))
* math: Add std::ostream operator<<(..) to all types; string_util: Add ↵Sven Göthel2024-04-1310-0/+112
| | | | [v]format_string(..) for [v]printf(..) formatting a string
* math: float_math.hpp: Fix API doc: Use correct float_iec559_* literal value ↵Sven Göthel2024-04-131-39/+39
| | | | names
* math: AffineTransform: Use epsilon aware is_zero() and equals() operationsSven Göthel2024-04-132-39/+33
|
* math: Migrate linear algebra + float IEEE 754 (IEC 559) functionality from ↵Sven Göthel2024-04-1320-151/+8114
| | | | | | | | | | | | | gfxbox2 and certain Jogl of mine classes to jau::math::** Chosen CamelCase (PascalCase) for class types, differing from gfxbox2. Status: - Compile clean - Tests -- test_math_float.cpp: Covers epsilon/zero/equal/compare/IEC559 of float_math.hpp -- test_math_vec.cpp: Covers Vec2f + Vec3f (TODO) -- TODO: Mat4f, Quaternion, Frustum, ...
* Add include/jau/float_types.hpp: Simple float literals for unit -> SI as floatSven Göthel2024-04-101-0/+66
|
* jau/ringbuffer.hpp: Resolve clang-tidy-15 clang-analyzer-core.DivideZero ↵Sven Göthel2024-04-101-22/+24
| | | | warning (=error)
* int_math_ct: jau::ct_abs(): Document UB, suppress UB w/ clang, fix unit testsSven Göthel2024-04-101-4/+6
|
* float_math: Simplify by dropping subnormal limit, rename ↵Sven Göthel2024-04-101-15/+67
| | | | {machine_->}equal{->s}(), add compare(), is_zero(), round_to_int(), adeg_to_rad(), rad_to_adeg()
* Restructure big_int_t -> big_int, jau/math.hpp -> jau/math/math_error.hpp ↵Sven Göthel2024-04-103-129/+127
| | | | (Refine API doc, MathError: add ro-access to math_error_t)
* cpp_pragma: Adding PRAGMA_DISABLE_WARNING_INT_OVERFLOW (clang) and ↵Sven Göthel2024-04-101-0/+4
| | | | PRAGMA_DISABLE_WARNING_RESTRICT (gcc)
* big_int_t: Fix & test free math function wrapper (min, max, clamp ..)Sven Göthel2024-03-021-10/+11
|
* big_int_ops: Determine 32- or 64-bit mp_word_bits by constexpr sizeof(void*) ↵Sven Göthel2024-03-021-4/+26
| | | | | | | and whether native int128_t is available We allow a compile time override via define JAU_FORCE_MP_WORD_32_BITS as used by test_big_int01.*
* big_int_t: Add to group Integer, encoding doc; Add mod_pow(), hex- & ↵Sven Göthel2024-03-021-12/+286
| | | | dec-string decoding (ctor), ctor via memory region, binary_encode() and general free math func wrapper
* string_util hexStringBytes(): Add pointer version and accomodate odd-length ↵Sven Göthel2024-03-021-1/+4
| | | | (no leading '0'), return size_t
* big_int_{t, ops}, ct_utils: Use size_t instead of nsize_t avoiding ↵Sven Göthel2024-03-023-230/+256
| | | | | | | | | potentially reduction in addressable space big_int_t opearations target vast addressable memory space, hence don't reduce it artificially. nsize_t is intended for smaller memory indices only.
* Robustness and versatility of byte_util: Use lb_endian enum class instead of ↵Sven Göthel2024-03-025-284/+318
| | | | | | | | | | | | 'boolean isLittleEndian'; Remove 'nsize_t byte_offset' and rely on given pointer Using a byte offset of type nsize_t would potentially reduce addressable space on a given platform and is not required for C++ as the pointer arithmetic can be used by the caller. Dropping the byte offset exposed the weakness of using a bool type for the little- big-endian switch, as an integer is automatically converted to bool. Hence we now use an enum class lb_endian only denoting little-, big-endian and additional native (the actual platform's encoding).
* big_int_t: Add naive x^y pow() function O(n)Sven Göthel2024-02-261-0/+34
|
* big_int_t: Fix operator/() 'const'Sven Göthel2024-02-261-6/+5
|
* ExceptionBase: Mark const string& conversion op noexceptSven Göthel2024-02-261-3/+2
|
* big_int_t: Handle errors via MathError exception (tested) and cleanup issues ↵Sven Göthel2024-02-262-97/+233
| | | | | | | | | | | | | | | | | (see below) - ~big_int_t() -> calls clear() to ensure memory is zero'ed out (secure) - Adjust 'noexcept', i.e. add where safe & drop where exceptions can be thrown - Throw jau::MathError exceptions: MathDomainError and MathDivByZeroError, resolving error handling - Make certain functions private, keep API clean - Add modulo operator overload and other certain useful ops (incomplete) -
* ExceptionBase: Add conversion to `const std::string&`, as required by ↵Sven Göthel2024-02-261-2/+5
| | | | Catch2's `REQUIRE_THROWS_MATCHES`; Let message() and backtrace() return const string& instead of copy
* Add math.hpp: `enum class math_error_t` (math_errhandling) -> MathError and ↵Sven Göthel2024-02-264-3/+108
| | | | specialisations
* Adding big_int_t, borrowed from Botan library & maintaining the ↵Sven Göthel2024-02-263-67/+1870
| | | | | | | | | | | | crypto-properties, also just allowing to utilize big intgral math Not all operations are supported yet, however - a quick bringup test for simple arithmetic and to_*_string() works. Merged with jaulib functionality (condensed) and dropped assembly ops in big_int_ops (TODO: Add back). Uses the Constant Time (CT) functionality from ct_utils.hpp and int_math_ct.hpp.
* Migrate Botan's ct_utils for Constant Time (CT) Mask<T> operations (initial ↵Sven Göthel2024-02-261-0/+385
| | | | | | commit) Botan and jaulib is released under the Simplified BSD License (see license.txt)
* int_math: Split Constant Time (CT) operations into int_math_ct w/ prefix ↵Sven Göthel2024-02-262-208/+292
| | | | | | | | | 'ct_' as desired for cryptographic operations For more information about constant time programming see Wagner, Molnar, et al "The Program Counter Security Model" This use-case has been retrieved from the Botan cryptography library.
* int_math: Add masked_merge(..)Sven Göthel2024-02-261-0/+16
|
* int_math: Add next_power_of_2() and round_to_power_of_2()Sven Göthel2024-02-261-2/+29
|
* int_math: round_{up,down}(): Detangle unsigned integral types for value n ↵Sven Göthel2024-02-261-6/+10
| | | | and alight_to
* int_math: sign() returns 'int' type (enough); Add round_{up,down}() and ↵Sven Göthel2024-02-261-2/+68
| | | | bit_count(); Split perf-bench of test_int_math01 -> test_int_math_perf01
* int_math: Hide experimental abs2, min2, max2, clamp2 behind define ↵Sven Göthel2024-02-251-4/+110
| | | | | | | | | JAU_INT_MATH_EXPERIMENTAL, .. tested performance on x86_64 shows that the correct versions with branching abs, min, max and clamp are of equal speed, if not even slightly faster. hence it is probably sane and safe to use the correct versions only ;-)
* cpp_lang_util: Add is_builtin_int128_available() and if supported: int128_t ↵Sven Göthel2024-02-251-3/+22
| | | | uint128_t
* int_math: Add branchless abs2(), is_power_of_2(); Add high_bit(); Fix ↵Sven Göthel2024-02-251-15/+122
| | | | {add,sub,mul}_overflow(); Add unit tests (test_int_math.cpp)
* Rename uint{128,192,256}_t -> uint{128,192,256}dp_t, avoiding collision with ↵Sven Göthel2024-02-255-85/+85
| | | | native or full uint128_t etc definitions; 'dp' stands for data-pack
* POctets: Add ctor taking initializer list, add remaining()v1.1.2Sven Gothel2023-10-281-1/+27
|
* EUI48.java: Reuse streaming byte ctor w/ pos; debug.hpp: Add DBG_WARN_PRINTSven Gothel2023-10-251-0/+3
|
* TOctets: Add put_octets* w/ explicit value offset and length to utilize only ↵Sven Gothel2023-10-201-0/+9
| | | | a subset
* uuid_t::operator==() is no more virtualSven Gothel2023-01-231-1/+1
|
* API doc enhancement: jau::function<R(A...)> and jau::type_infoSven Gothel2023-01-032-47/+63
|
* jau::ringbuffer: Add 'End of Stream' (EOS) concept and utilize it for ↵v1.1.1Sven Gothel2023-01-023-26/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | jau::io::ByteInStream_[URL|Feed]'s available() and read() operation. jau::ringbuffer: Add 'End of Stream' (EOS) concept to unblock all read-operations from this point onwards and unblocking a potentially currently blocked reader thread. The EOS concept is required to allow blocking operations from a consumer (reader) w/o knowledge of the content-size, having the producer (writer) signaling EOS at the end and unblocking all read-operations. Fuerther, after unblocking a potentially blocker reader-thread, the failure criteria is now being checked as for the `timeout` case. This allows a read-thread being unblocked (interrupted) after writing the last chunk and hence picking up this last written data. +++ Utilize ringbuffer EOS concept for jau::io::ByteInStream_[URL|Feed]'s available() and read() operation, i.e. both methods utilize blocking operations. After the producer (URL: Our Curl consume callback; Feed: Manual set_eof()) marks EOS on the ringbuffer, all blocking read-operations are permanently unblocked and a current read-thread also interrupted. +++ Passed test_bytestream01 and test_iostream01 while causing full CPU load via `stress --cpu $(getconf _NPROCESSORS_ONLN)`.