diff options
author | Sven Gothel <[email protected]> | 2022-11-21 12:59:58 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-11-21 12:59:58 +0100 |
commit | ea01b4e58dbbb8f4f516326f8f73cd5b3ac58554 (patch) | |
tree | 9a96291816009b8814b57cfc867604aa6b3c6429 /include/jau | |
parent | 329950ff72b4f51028722d52e8aaf90f1015356f (diff) |
ClangTidy: Misc fixes: Use override, conversion, nullptr, c-includes, default implementation (ctor, dtor, ..), ..
Diffstat (limited to 'include/jau')
-rw-r--r-- | include/jau/byte_stream.hpp | 8 | ||||
-rw-r--r-- | include/jau/byte_util.hpp | 24 | ||||
-rw-r--r-- | include/jau/callocator.hpp | 5 | ||||
-rw-r--r-- | include/jau/callocator_sec.hpp | 5 | ||||
-rw-r--r-- | include/jau/counting_allocator.hpp | 2 | ||||
-rw-r--r-- | include/jau/counting_callocator.hpp | 2 | ||||
-rw-r--r-- | include/jau/cow_vector.hpp | 3 | ||||
-rw-r--r-- | include/jau/cpp_lang_util.hpp | 6 | ||||
-rw-r--r-- | include/jau/cpuid.hpp | 530 | ||||
-rw-r--r-- | include/jau/float_math.hpp | 3 | ||||
-rw-r--r-- | include/jau/fraction_type.hpp | 2 | ||||
-rw-r--r-- | include/jau/java_uplink.hpp | 2 | ||||
-rw-r--r-- | include/jau/octets.hpp | 6 |
13 files changed, 297 insertions, 301 deletions
diff --git a/include/jau/byte_stream.hpp b/include/jau/byte_stream.hpp index a95a9a4..7024d05 100644 --- a/include/jau/byte_stream.hpp +++ b/include/jau/byte_stream.hpp @@ -121,7 +121,7 @@ namespace jau::io { iostate_func& operator=(const iostate_func &o) noexcept = default; iostate_func& operator=(iostate_func &&o) noexcept = default; - virtual ~iostate_func() noexcept {} + virtual ~iostate_func() noexcept = default; /** Clears state flags by assignment to the given value. */ virtual void clear(const iostate state = iostate::goodbit) noexcept { m_state = state; } @@ -191,7 +191,7 @@ namespace jau::io { ByteInStream() noexcept : iostate_func() {} - virtual ~ByteInStream() noexcept = default; + ~ByteInStream() noexcept override = default; ByteInStream& operator=(const ByteInStream&) = delete; ByteInStream(const ByteInStream&) = delete; @@ -450,7 +450,7 @@ namespace jau::io { void close() noexcept override; - virtual ~ByteInStream_File() noexcept override { close(); } + ~ByteInStream_File() noexcept override { close(); } uint64_t tellg() const noexcept override { return m_bytes_consumed; } @@ -793,7 +793,7 @@ namespace jau::io { { public: ByteOutStream() = default; - virtual ~ByteOutStream() noexcept = default; + ~ByteOutStream() noexcept override = default; ByteOutStream& operator=(const ByteOutStream&) = delete; ByteOutStream(const ByteOutStream&) = delete; diff --git a/include/jau/byte_util.hpp b/include/jau/byte_util.hpp index 582e60f..e74adb2 100644 --- a/include/jau/byte_util.hpp +++ b/include/jau/byte_util.hpp @@ -424,7 +424,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return n; } else { - return uint128_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint128_t cpu_to_be(uint128_t const & h) noexcept { @@ -433,7 +433,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return h; } else { - return uint128_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint128_t le_to_cpu(uint128_t const & l) noexcept { @@ -442,7 +442,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return bswap(l); } else { - return uint128_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint128_t cpu_to_le(uint128_t const & h) noexcept { @@ -451,7 +451,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return bswap(h); } else { - return uint128_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } @@ -461,7 +461,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return n; } else { - return uint192_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint192_t cpu_to_be(uint192_t const & h) noexcept { @@ -470,7 +470,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return h; } else { - return uint192_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint192_t le_to_cpu(uint192_t const & l) noexcept { @@ -479,7 +479,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return bswap(l); } else { - return uint192_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint192_t cpu_to_le(uint192_t const & h) noexcept { @@ -488,7 +488,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return bswap(h); } else { - return uint192_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } @@ -498,7 +498,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return n; } else { - return uint256_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint256_t cpu_to_be(uint256_t const & h) noexcept { @@ -507,7 +507,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return h; } else { - return uint256_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint256_t le_to_cpu(uint256_t const & l) noexcept { @@ -516,7 +516,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return bswap(l); } else { - return uint256_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } constexpr uint256_t cpu_to_le(uint256_t const & h) noexcept { @@ -525,7 +525,7 @@ namespace jau { } else if constexpr ( isBigEndian() ) { return bswap(h); } else { - return uint256_t(); // unreachable -> static_assert(..) above + return {}; // unreachable -> static_assert(..) above } } diff --git a/include/jau/callocator.hpp b/include/jau/callocator.hpp index 80a1844..582483c 100644 --- a/include/jau/callocator.hpp +++ b/include/jau/callocator.hpp @@ -71,8 +71,7 @@ struct callocator typedef value_type_mutable* pointer_mutable; public: - callocator() noexcept - { } // C++11 + callocator() noexcept = default; // C++11 #if __cplusplus > 201703L constexpr callocator(const callocator& other) noexcept @@ -95,7 +94,7 @@ struct callocator #if __cplusplus > 201703L constexpr ~callocator() {} // C++20 #else - ~callocator() {} + ~callocator() = default; #endif #if __cplusplus <= 201703L diff --git a/include/jau/callocator_sec.hpp b/include/jau/callocator_sec.hpp index 4a5ffb8..e73680c 100644 --- a/include/jau/callocator_sec.hpp +++ b/include/jau/callocator_sec.hpp @@ -73,8 +73,7 @@ struct callocator_sec typedef value_type_mutable* pointer_mutable; public: - callocator_sec() noexcept - { } // C++11 + callocator_sec() noexcept = default; // C++11 #if __cplusplus > 201703L constexpr callocator_sec(const callocator_sec& other) noexcept @@ -97,7 +96,7 @@ struct callocator_sec #if __cplusplus > 201703L constexpr ~callocator_sec() {} // C++20 #else - ~callocator_sec() {} + ~callocator_sec() = default; #endif #if __cplusplus <= 201703L diff --git a/include/jau/counting_allocator.hpp b/include/jau/counting_allocator.hpp index d6e9f0e..169cce6 100644 --- a/include/jau/counting_allocator.hpp +++ b/include/jau/counting_allocator.hpp @@ -143,7 +143,7 @@ struct counting_allocator : public std::allocator<T> #if __cplusplus > 201703L constexpr ~counting_allocator() {} // C++20 #else - ~counting_allocator() {} + ~counting_allocator() = default; #endif #if __cplusplus <= 201703L diff --git a/include/jau/counting_callocator.hpp b/include/jau/counting_callocator.hpp index da9ff7d..d6a022d 100644 --- a/include/jau/counting_callocator.hpp +++ b/include/jau/counting_callocator.hpp @@ -146,7 +146,7 @@ struct counting_callocator : public jau::callocator<T> #if __cplusplus > 201703L constexpr ~counting_callocator() {} // C++20 #else - ~counting_callocator() {} + ~counting_callocator() = default; #endif #if __cplusplus <= 201703L diff --git a/include/jau/cow_vector.hpp b/include/jau/cow_vector.hpp index a65ff2e..1421d50 100644 --- a/include/jau/cow_vector.hpp +++ b/include/jau/cow_vector.hpp @@ -42,6 +42,7 @@ #include <jau/basic_types.hpp> #include <jau/ordered_atomic.hpp> #include <jau/cow_iterator.hpp> +#include <jau/basic_algos.hpp> namespace jau { @@ -259,7 +260,7 @@ namespace jau { : store_ref(std::make_shared<storage_t>(initlist, alloc)), sync_atomic(false) { } - ~cow_vector() noexcept { } + ~cow_vector() noexcept = default; /** * Returns <code>std::numeric_limits<difference_type>::max()</code> as the maximum array size. diff --git a/include/jau/cpp_lang_util.hpp b/include/jau/cpp_lang_util.hpp index c4f67b2..53ef12d 100644 --- a/include/jau/cpp_lang_util.hpp +++ b/include/jau/cpp_lang_util.hpp @@ -27,6 +27,8 @@ #include <type_traits> #include <typeinfo> +#include <string> +#include <cstring> namespace jau { @@ -392,7 +394,7 @@ namespace jau { /** Returns true if given signature is not nullptr and has a string length > 0, otherwise false. */ static constexpr bool is_valid(const char* signature) noexcept { - return nullptr != signature && 0 < strlen(signature); + return nullptr != signature && 0 < ::strlen(signature); } /** Aborts program execution if given signature is nullptr or has a string length == 0. */ @@ -400,7 +402,7 @@ namespace jau { if( nullptr == signature ) { fprintf(stderr, "ABORT @ %s:%d %s: CTTI signature nullptr\n", __FILE__, __LINE__, __func__); ::abort(); - } else if( 0 == strlen(signature) ) { + } else if( 0 == ::strlen(signature) ) { fprintf(stderr, "ABORT @ %s:%d %s: CTTI signature zero sized\n", __FILE__, __LINE__, __func__); ::abort(); } diff --git a/include/jau/cpuid.hpp b/include/jau/cpuid.hpp index bec87df..2d15313 100644 --- a/include/jau/cpuid.hpp +++ b/include/jau/cpuid.hpp @@ -27,288 +27,282 @@ #include <string> -namespace jau { +namespace jau::cpu { - namespace cpu { + /** \addtogroup SysUtils + * + * @{ + */ - /** \addtogroup SysUtils - * - * @{ - */ + /** + * Returns the compile time pointer architecture size in bits. + * e.g. 64-bit for LP64 and 32-bit for LP32. + * + * Implementations uses `sizeof(void*)`, i.e. the address bus size, + * the common denominator across all LP64, ILP64 and LLP64 for 64-bit. + */ + constexpr size_t get_arch_psize() noexcept { return sizeof(void*) * 8; } - /** - * Returns the compile time pointer architecture size in bits. - * e.g. 64-bit for LP64 and 32-bit for LP32. - * - * Implementations uses `sizeof(void*)`, i.e. the address bus size, - * the common denominator across all LP64, ILP64 and LLP64 for 64-bit. - */ - constexpr size_t get_arch_psize() noexcept { - return sizeof(void*) * 8; - } + enum class cpu_family : uint16_t { + /** Undefined */ + none = 0, + /** AMD/Intel 32-bit */ + x86_32 = 1, + /** AMD/Intel 64-bit */ + x86_64 = 2, + /** ARM 32bit */ + arm32 = 3, + /** ARM 64bit */ + arm64 = 4, + /** Power PC */ + ppc = 5, + /** SPARC */ + sparc = 6, + /** Mips */ + mips = 7, + /** PA RISC */ + pa_risc = 8, + /** Itanium */ + ia64 = 9, + /** Hitachi SuperH */ + superh = 10 + }; + constexpr uint16_t number(const cpu_family rhs) noexcept { + return static_cast<uint16_t>(rhs); + } + constexpr cpu_family operator ~(const cpu_family rhs) noexcept { + return static_cast<cpu_family> ( ~number(rhs) ); + } + constexpr cpu_family operator ^(const cpu_family lhs, const cpu_family rhs) noexcept { + return static_cast<cpu_family> ( number(lhs) ^ number(rhs) ); + } + constexpr cpu_family operator |(const cpu_family lhs, const cpu_family rhs) noexcept { + return static_cast<cpu_family> ( number(lhs) | number(rhs) ); + } + constexpr cpu_family operator &(const cpu_family lhs, const cpu_family rhs) noexcept { + return static_cast<cpu_family> ( number(lhs) & number(rhs) ); + } + constexpr cpu_family& operator |=(cpu_family& lhs, const cpu_family rhs) noexcept { + lhs = static_cast<cpu_family> ( number(lhs) | number(rhs) ); + return lhs; + } + constexpr cpu_family& operator &=(cpu_family& lhs, const cpu_family rhs) noexcept { + lhs = static_cast<cpu_family> ( number(lhs) & number(rhs) ); + return lhs; + } + constexpr cpu_family& operator ^=(cpu_family& lhs, const cpu_family rhs) noexcept { + lhs = static_cast<cpu_family> ( number(lhs) ^ number(rhs) ); + return lhs; + } + constexpr bool operator ==(const cpu_family lhs, const cpu_family rhs) noexcept { + return number(lhs) == number(rhs); + } + constexpr bool operator !=(const cpu_family lhs, const cpu_family rhs) noexcept { + return !( lhs == rhs ); + } + constexpr bool is_set(const cpu_family mask, const cpu_family bit) noexcept { + return bit == ( mask & bit ); + } + cpu_family get_cpu_family() noexcept; + std::string to_string(const cpu_family v) noexcept; - enum class cpu_family : uint16_t { - /** Undefined */ - none = 0, - /** AMD/Intel 32-bit */ - x86_32 = 1, - /** AMD/Intel 64-bit */ - x86_64 = 2, - /** ARM 32bit */ - arm32 = 3, - /** ARM 64bit */ - arm64 = 4, - /** Power PC */ - ppc = 5, - /** SPARC */ - sparc = 6, - /** Mips */ - mips = 7, - /** PA RISC */ - pa_risc = 8, - /** Itanium */ - ia64 = 9, - /** Hitachi SuperH */ - superh = 10 - }; - constexpr uint16_t number(const cpu_family rhs) noexcept { - return static_cast<uint16_t>(rhs); - } - constexpr cpu_family operator ~(const cpu_family rhs) noexcept { - return static_cast<cpu_family> ( ~number(rhs) ); - } - constexpr cpu_family operator ^(const cpu_family lhs, const cpu_family rhs) noexcept { - return static_cast<cpu_family> ( number(lhs) ^ number(rhs) ); - } - constexpr cpu_family operator |(const cpu_family lhs, const cpu_family rhs) noexcept { - return static_cast<cpu_family> ( number(lhs) | number(rhs) ); - } - constexpr cpu_family operator &(const cpu_family lhs, const cpu_family rhs) noexcept { - return static_cast<cpu_family> ( number(lhs) & number(rhs) ); - } - constexpr cpu_family& operator |=(cpu_family& lhs, const cpu_family rhs) noexcept { - lhs = static_cast<cpu_family> ( number(lhs) | number(rhs) ); - return lhs; - } - constexpr cpu_family& operator &=(cpu_family& lhs, const cpu_family rhs) noexcept { - lhs = static_cast<cpu_family> ( number(lhs) & number(rhs) ); - return lhs; - } - constexpr cpu_family& operator ^=(cpu_family& lhs, const cpu_family rhs) noexcept { - lhs = static_cast<cpu_family> ( number(lhs) ^ number(rhs) ); - return lhs; - } - constexpr bool operator ==(const cpu_family lhs, const cpu_family rhs) noexcept { - return number(lhs) == number(rhs); - } - constexpr bool operator !=(const cpu_family lhs, const cpu_family rhs) noexcept { - return !( lhs == rhs ); - } - constexpr bool is_set(const cpu_family mask, const cpu_family bit) noexcept { - return bit == ( mask & bit ); - } - cpu_family get_cpu_family() noexcept; - std::string to_string(const cpu_family v) noexcept; + enum class arm32_hwcap1 : uint64_t { + none = 0, + swp = (1 << 0), + half = (1 << 1), + thumb = (1 << 2), + bits26 = (1 << 3), + fmult = (1 << 4), + fpa = (1 << 5), + vfp = (1 << 6), + edsp = (1 << 7), + java = (1 << 8), + iwmmxt = (1 << 9), + crunch = (1 << 10), + thumbee = (1 << 11), + neon = (1 << 12), + vfp_v3 = (1 << 13), + vfp_v3_d16 = (1 << 14), + tls = (1 << 15), + vfp_v4 = (1 << 16), + idiva = (1 << 17), + idivt = (1 << 18), + vfp_d32 = (1 << 19), + lpae = (1 << 20), + evtstrm = (1 << 21), - enum class arm32_hwcap1 : uint64_t { - none = 0, - swp = (1 << 0), - half = (1 << 1), - thumb = (1 << 2), - bits26 = (1 << 3), - fmult = (1 << 4), - fpa = (1 << 5), - vfp = (1 << 6), - edsp = (1 << 7), - java = (1 << 8), - iwmmxt = (1 << 9), - crunch = (1 << 10), - thumbee = (1 << 11), - neon = (1 << 12), - vfp_v3 = (1 << 13), - vfp_v3_d16 = (1 << 14), - tls = (1 << 15), - vfp_v4 = (1 << 16), - idiva = (1 << 17), - idivt = (1 << 18), - vfp_d32 = (1 << 19), - lpae = (1 << 20), - evtstrm = (1 << 21), + at_hwcap_1 = 16 + }; + constexpr uint64_t number(const arm32_hwcap1 rhs) noexcept { + return static_cast<uint64_t>(rhs); + } + constexpr arm32_hwcap1 operator ~(const arm32_hwcap1 rhs) noexcept { + return static_cast<arm32_hwcap1> ( ~number(rhs) ); + } + constexpr arm32_hwcap1 operator ^(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { + return static_cast<arm32_hwcap1> ( number(lhs) ^ number(rhs) ); + } + constexpr arm32_hwcap1 operator |(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { + return static_cast<arm32_hwcap1> ( number(lhs) | number(rhs) ); + } + constexpr arm32_hwcap1 operator &(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { + return static_cast<arm32_hwcap1> ( number(lhs) & number(rhs) ); + } + constexpr arm32_hwcap1& operator |=(arm32_hwcap1& lhs, const arm32_hwcap1 rhs) noexcept { + lhs = static_cast<arm32_hwcap1> ( number(lhs) | number(rhs) ); + return lhs; + } + constexpr arm32_hwcap1& operator &=(arm32_hwcap1& lhs, const arm32_hwcap1 rhs) noexcept { + lhs = static_cast<arm32_hwcap1> ( number(lhs) & number(rhs) ); + return lhs; + } + constexpr arm32_hwcap1& operator ^=(arm32_hwcap1& lhs, const arm32_hwcap1 rhs) noexcept { + lhs = static_cast<arm32_hwcap1> ( number(lhs) ^ number(rhs) ); + return lhs; + } + constexpr bool operator ==(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { + return number(lhs) == number(rhs); + } + constexpr bool operator !=(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { + return !( lhs == rhs ); + } + constexpr bool is_set(const arm32_hwcap1 mask, const arm32_hwcap1 bit) noexcept { + return bit == ( mask & bit ); + } + std::string to_string(const arm32_hwcap1 hwcaps) noexcept; - at_hwcap_1 = 16 - }; - constexpr uint64_t number(const arm32_hwcap1 rhs) noexcept { - return static_cast<uint64_t>(rhs); - } - constexpr arm32_hwcap1 operator ~(const arm32_hwcap1 rhs) noexcept { - return static_cast<arm32_hwcap1> ( ~number(rhs) ); - } - constexpr arm32_hwcap1 operator ^(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { - return static_cast<arm32_hwcap1> ( number(lhs) ^ number(rhs) ); - } - constexpr arm32_hwcap1 operator |(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { - return static_cast<arm32_hwcap1> ( number(lhs) | number(rhs) ); - } - constexpr arm32_hwcap1 operator &(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { - return static_cast<arm32_hwcap1> ( number(lhs) & number(rhs) ); - } - constexpr arm32_hwcap1& operator |=(arm32_hwcap1& lhs, const arm32_hwcap1 rhs) noexcept { - lhs = static_cast<arm32_hwcap1> ( number(lhs) | number(rhs) ); - return lhs; - } - constexpr arm32_hwcap1& operator &=(arm32_hwcap1& lhs, const arm32_hwcap1 rhs) noexcept { - lhs = static_cast<arm32_hwcap1> ( number(lhs) & number(rhs) ); - return lhs; - } - constexpr arm32_hwcap1& operator ^=(arm32_hwcap1& lhs, const arm32_hwcap1 rhs) noexcept { - lhs = static_cast<arm32_hwcap1> ( number(lhs) ^ number(rhs) ); - return lhs; - } - constexpr bool operator ==(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { - return number(lhs) == number(rhs); - } - constexpr bool operator !=(const arm32_hwcap1 lhs, const arm32_hwcap1 rhs) noexcept { - return !( lhs == rhs ); - } - constexpr bool is_set(const arm32_hwcap1 mask, const arm32_hwcap1 bit) noexcept { - return bit == ( mask & bit ); - } - std::string to_string(const arm32_hwcap1 hwcaps) noexcept; + enum class arm32_hwcap2 : uint64_t { + none = 0, + aes = (1 << 0), + pmull = (1 << 1), + sha1 = (1 << 2), + sha2 = (1 << 3), + crc32 = (1 << 4), - enum class arm32_hwcap2 : uint64_t { - none = 0, - aes = (1 << 0), - pmull = (1 << 1), - sha1 = (1 << 2), - sha2 = (1 << 3), - crc32 = (1 << 4), + at_hwcap_2 = 26 + }; + constexpr uint64_t number(const arm32_hwcap2 rhs) noexcept { + return static_cast<uint64_t>(rhs); + } + constexpr arm32_hwcap2 operator ~(const arm32_hwcap2 rhs) noexcept { + return static_cast<arm32_hwcap2> ( ~number(rhs) ); + } + constexpr arm32_hwcap2 operator ^(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { + return static_cast<arm32_hwcap2> ( number(lhs) ^ number(rhs) ); + } + constexpr arm32_hwcap2 operator |(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { + return static_cast<arm32_hwcap2> ( number(lhs) | number(rhs) ); + } + constexpr arm32_hwcap2 operator &(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { + return static_cast<arm32_hwcap2> ( number(lhs) & number(rhs) ); + } + constexpr arm32_hwcap2& operator |=(arm32_hwcap2& lhs, const arm32_hwcap2 rhs) noexcept { + lhs = static_cast<arm32_hwcap2> ( number(lhs) | number(rhs) ); + return lhs; + } + constexpr arm32_hwcap2& operator &=(arm32_hwcap2& lhs, const arm32_hwcap2 rhs) noexcept { + lhs = static_cast<arm32_hwcap2> ( number(lhs) & number(rhs) ); + return lhs; + } + constexpr arm32_hwcap2& operator ^=(arm32_hwcap2& lhs, const arm32_hwcap2 rhs) noexcept { + lhs = static_cast<arm32_hwcap2> ( number(lhs) ^ number(rhs) ); + return lhs; + } + constexpr bool operator ==(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { + return number(lhs) == number(rhs); + } + constexpr bool operator !=(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { + return !( lhs == rhs ); + } + constexpr bool is_set(const arm32_hwcap2 mask, const arm32_hwcap2 bit) noexcept { + return bit == ( mask & bit ); + } + std::string to_string(const arm32_hwcap2 hwcaps) noexcept; - at_hwcap_2 = 26 - }; - constexpr uint64_t number(const arm32_hwcap2 rhs) noexcept { - return static_cast<uint64_t>(rhs); - } - constexpr arm32_hwcap2 operator ~(const arm32_hwcap2 rhs) noexcept { - return static_cast<arm32_hwcap2> ( ~number(rhs) ); - } - constexpr arm32_hwcap2 operator ^(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { - return static_cast<arm32_hwcap2> ( number(lhs) ^ number(rhs) ); - } - constexpr arm32_hwcap2 operator |(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { - return static_cast<arm32_hwcap2> ( number(lhs) | number(rhs) ); - } - constexpr arm32_hwcap2 operator &(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { - return static_cast<arm32_hwcap2> ( number(lhs) & number(rhs) ); - } - constexpr arm32_hwcap2& operator |=(arm32_hwcap2& lhs, const arm32_hwcap2 rhs) noexcept { - lhs = static_cast<arm32_hwcap2> ( number(lhs) | number(rhs) ); - return lhs; - } - constexpr arm32_hwcap2& operator &=(arm32_hwcap2& lhs, const arm32_hwcap2 rhs) noexcept { - lhs = static_cast<arm32_hwcap2> ( number(lhs) & number(rhs) ); - return lhs; - } - constexpr arm32_hwcap2& operator ^=(arm32_hwcap2& lhs, const arm32_hwcap2 rhs) noexcept { - lhs = static_cast<arm32_hwcap2> ( number(lhs) ^ number(rhs) ); - return lhs; - } - constexpr bool operator ==(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { - return number(lhs) == number(rhs); - } - constexpr bool operator !=(const arm32_hwcap2 lhs, const arm32_hwcap2 rhs) noexcept { - return !( lhs == rhs ); - } - constexpr bool is_set(const arm32_hwcap2 mask, const arm32_hwcap2 bit) noexcept { - return bit == ( mask & bit ); - } - std::string to_string(const arm32_hwcap2 hwcaps) noexcept; + bool get_arm32_hwcap(arm32_hwcap1& hwcap1, arm32_hwcap2& hwcap2) noexcept; - bool get_arm32_hwcap(arm32_hwcap1& hwcap1, arm32_hwcap2& hwcap2) noexcept; + enum class arm64_hwcap : uint64_t { + none = 0, + fp = (1 << 0), + asimd = (1 << 1), + evtstrm = (1 << 2), + aes = (1 << 3), + pmull = (1 << 4), + sha1 = (1 << 5), + sha2 = (1 << 6), + crc32 = (1 << 7), + atomics = (1 << 8), + fphp = (1 << 9), + asimdhp = (1 << 10), + cpuid = (1 << 11), + asimdrdm = (1 << 12), + jscvt = (1 << 13), + fcma = (1 << 14), + lrcpc = (1 << 15), + dcpop = (1 << 16), + sha3 = (1 << 17), + sm3 = (1 << 18), + sm4 = (1 << 19), + asimddp = (1 << 20), + sha512 = (1 << 21), + sve = (1 << 22), + asimdfhm = (1 << 23), + dit = (1 << 24), + uscat = (1 << 25), + ilrcpc = (1 << 26), + flagm = (1 << 27), + ssbs = (1 << 28), + sb = (1 << 29), + paca = (1 << 30), + pacg = (1UL << 31), - enum class arm64_hwcap : uint64_t { - none = 0, - fp = (1 << 0), - asimd = (1 << 1), - evtstrm = (1 << 2), - aes = (1 << 3), - pmull = (1 << 4), - sha1 = (1 << 5), - sha2 = (1 << 6), - crc32 = (1 << 7), - atomics = (1 << 8), - fphp = (1 << 9), - asimdhp = (1 << 10), - cpuid = (1 << 11), - asimdrdm = (1 << 12), - jscvt = (1 << 13), - fcma = (1 << 14), - lrcpc = (1 << 15), - dcpop = (1 << 16), - sha3 = (1 << 17), - sm3 = (1 << 18), - sm4 = (1 << 19), - asimddp = (1 << 20), - sha512 = (1 << 21), - sve = (1 << 22), - asimdfhm = (1 << 23), - dit = (1 << 24), - uscat = (1 << 25), - ilrcpc = (1 << 26), - flagm = (1 << 27), - ssbs = (1 << 28), - sb = (1 << 29), - paca = (1 << 30), - pacg = (1UL << 31), + at_hwcap = 16 + }; + constexpr uint64_t number(const arm64_hwcap rhs) noexcept { + return static_cast<uint64_t>(rhs); + } + constexpr arm64_hwcap operator ~(const arm64_hwcap rhs) noexcept { + return static_cast<arm64_hwcap> ( ~number(rhs) ); + } + constexpr arm64_hwcap operator ^(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { + return static_cast<arm64_hwcap> ( number(lhs) ^ number(rhs) ); + } + constexpr arm64_hwcap operator |(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { + return static_cast<arm64_hwcap> ( number(lhs) | number(rhs) ); + } + constexpr arm64_hwcap operator &(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { + return static_cast<arm64_hwcap> ( number(lhs) & number(rhs) ); + } + constexpr arm64_hwcap& operator |=(arm64_hwcap& lhs, const arm64_hwcap rhs) noexcept { + lhs = static_cast<arm64_hwcap> ( number(lhs) | number(rhs) ); + return lhs; + } + constexpr arm64_hwcap& operator &=(arm64_hwcap& lhs, const arm64_hwcap rhs) noexcept { + lhs = static_cast<arm64_hwcap> ( number(lhs) & number(rhs) ); + return lhs; + } + constexpr arm64_hwcap& operator ^=(arm64_hwcap& lhs, const arm64_hwcap rhs) noexcept { + lhs = static_cast<arm64_hwcap> ( number(lhs) ^ number(rhs) ); + return lhs; + } + constexpr bool operator ==(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { + return number(lhs) == number(rhs); + } + constexpr bool operator !=(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { + return !( lhs == rhs ); + } + constexpr bool is_set(const arm64_hwcap mask, const arm64_hwcap bit) noexcept { + return bit == ( mask & bit ); + } + std::string to_string(const arm64_hwcap hwcaps) noexcept; - at_hwcap = 16 - }; - constexpr uint64_t number(const arm64_hwcap rhs) noexcept { - return static_cast<uint64_t>(rhs); - } - constexpr arm64_hwcap operator ~(const arm64_hwcap rhs) noexcept { - return static_cast<arm64_hwcap> ( ~number(rhs) ); - } - constexpr arm64_hwcap operator ^(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { - return static_cast<arm64_hwcap> ( number(lhs) ^ number(rhs) ); - } - constexpr arm64_hwcap operator |(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { - return static_cast<arm64_hwcap> ( number(lhs) | number(rhs) ); - } - constexpr arm64_hwcap operator &(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { - return static_cast<arm64_hwcap> ( number(lhs) & number(rhs) ); - } - constexpr arm64_hwcap& operator |=(arm64_hwcap& lhs, const arm64_hwcap rhs) noexcept { - lhs = static_cast<arm64_hwcap> ( number(lhs) | number(rhs) ); - return lhs; - } - constexpr arm64_hwcap& operator &=(arm64_hwcap& lhs, const arm64_hwcap rhs) noexcept { - lhs = static_cast<arm64_hwcap> ( number(lhs) & number(rhs) ); - return lhs; - } - constexpr arm64_hwcap& operator ^=(arm64_hwcap& lhs, const arm64_hwcap rhs) noexcept { - lhs = static_cast<arm64_hwcap> ( number(lhs) ^ number(rhs) ); - return lhs; - } - constexpr bool operator ==(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { - return number(lhs) == number(rhs); - } - constexpr bool operator !=(const arm64_hwcap lhs, const arm64_hwcap rhs) noexcept { - return !( lhs == rhs ); - } - constexpr bool is_set(const arm64_hwcap mask, const arm64_hwcap bit) noexcept { - return bit == ( mask & bit ); - } - std::string to_string(const arm64_hwcap hwcaps) noexcept; + bool get_arm64_hwcap(arm64_hwcap& hwcap) noexcept; - bool get_arm64_hwcap(arm64_hwcap& hwcap) noexcept; + void print_cpu_info(FILE* stream) noexcept; - void print_cpu_info(FILE* stream) noexcept; + /**@}*/ - /**@}*/ - - } // namespace cpu - -} // namespace jau +} // namespace jau::cpu #endif /* JAU_CPUID_HPP_ */ diff --git a/include/jau/float_math.hpp b/include/jau/float_math.hpp index ed16868..f603bb8 100644 --- a/include/jau/float_math.hpp +++ b/include/jau/float_math.hpp @@ -64,7 +64,8 @@ namespace jau { */ template<class T> typename std::enable_if<!std::numeric_limits<T>::is_integer, T>::type - machineEpsilon() { + machineEpsilon() + { const T one(1); const T two(2); T x = one, res; diff --git a/include/jau/fraction_type.hpp b/include/jau/fraction_type.hpp index 4272ed9..12a7884 100644 --- a/include/jau/fraction_type.hpp +++ b/include/jau/fraction_type.hpp @@ -29,7 +29,7 @@ #include <chrono> #include <condition_variable> -#include <stdio.h> +#include <cstdio> #include <cinttypes> #include <cstdint> diff --git a/include/jau/java_uplink.hpp b/include/jau/java_uplink.hpp index 17c079d..0ba17c7 100644 --- a/include/jau/java_uplink.hpp +++ b/include/jau/java_uplink.hpp @@ -49,7 +49,7 @@ namespace jau::jni { */ class JavaAnon { public: - virtual ~JavaAnon() noexcept { } + virtual ~JavaAnon() noexcept = default; virtual std::string toString() const noexcept { return "JavaAnon[???]"; } }; typedef std::shared_ptr<JavaAnon> JavaAnonRef; diff --git a/include/jau/octets.hpp b/include/jau/octets.hpp index 2e3b325..d6d93e0 100644 --- a/include/jau/octets.hpp +++ b/include/jau/octets.hpp @@ -158,7 +158,7 @@ namespace jau { TROOctets& operator=(const TROOctets &o) noexcept = default; TROOctets& operator=(TROOctets &&o) noexcept = default; - virtual ~TROOctets() noexcept {} + virtual ~TROOctets() noexcept = default; inline void check_range(const nsize_t i, const nsize_t count, const char *file, int line) const { if( i+count > _size ) { @@ -335,7 +335,7 @@ namespace jau { TOctets& operator=(const TOctets &o) noexcept = default; TOctets& operator=(TOctets &&o) noexcept = default; - virtual ~TOctets() noexcept override {} + ~TOctets() noexcept override = default; void put_int8(const nsize_t i, const int8_t v) { check_range(i, 1); @@ -756,7 +756,7 @@ namespace jau { return *this; } - virtual ~POctets() noexcept override { + ~POctets() noexcept override { freeData(); setData(nullptr, 0, byte_order()); _capacity=0; |