From be8e1b23909e85820cc929a382f13dfb59a429e1 Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Mon, 5 May 2025 20:37:36 -0600 Subject: [PATCH 1/2] :books: Update documentation for byterator Problem: - `byterator` doesn't document the 64-bit functionality. - Documentation for supported compilers is out of date. Solution: - Update `byterator` docs to add 64-bit functions. - Update documentation for supported toolchains. --- README.md | 2 +- docs/byterator.adoc | 4 ++++ docs/intro.adoc | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8fdf781..2d40dce 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Some of the extras are available only with C++20 or later. *stdx* supports: -- clang 14 through 19 +- clang 14 through 20 - gcc 12 through 14 See the [full documentation](https://intel.github.io/cpp-std-extensions/). diff --git a/docs/byterator.adoc b/docs/byterator.adoc index 61f7004..eabb992 100644 --- a/docs/byterator.adoc +++ b/docs/byterator.adoc @@ -72,6 +72,10 @@ i.writeu16(v16); // write and advance auto v32 = i.peeku32(); // read value without advancing v32 = i.readu32(); // read and advance i.writeu32(v32); // write and advance + +auto v64 = i.peeku64(); // read value without advancing +v64 = i.readu64(); // read and advance +i.writeu64(v64); // write and advance ---- These convenience functions are implemented by function templates that offer diff --git a/docs/intro.adoc b/docs/intro.adoc index 235683e..6736058 100644 --- a/docs/intro.adoc +++ b/docs/intro.adoc @@ -21,8 +21,11 @@ The following compilers are supported: * clang 16 * clang 17 * clang 18 +* clang 19 +* clang 20 * gcc 12 * gcc 13 +* gcc 14 In general, `stdx` supports the C++17 standard; however some functionality is available only in 20 and later. From 006cef9bf3f7a08b6ce7fd1cc1f0801486a8ab72 Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Mon, 5 May 2025 20:39:46 -0600 Subject: [PATCH 2/2] :art: Don't throw away argument to `smallest_uint` Problem: - `smallest_uint` returns zero rather than the template argument it is passed. Solution: - Return the argument passed. --- docs/bit.adoc | 4 ++-- include/stdx/bit.hpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/bit.adoc b/docs/bit.adoc index 2b7205e..db5ea96 100644 --- a/docs/bit.adoc +++ b/docs/bit.adoc @@ -125,8 +125,8 @@ integral type that will fit a compile-time value. [source,cpp] ---- -constexpr auto x = stdx::smallest_uint<42>(); // std::uint8_t{} -constexpr auto y = stdx::smallest_uint<1337>(); // std::uint16_t{} +constexpr auto x = stdx::smallest_uint<42>(); // std::uint8_t{42} +constexpr auto y = stdx::smallest_uint<1337>(); // std::uint16_t{1337} // smallest_uint_t is the type of a call to smallest_uint using T = stdx::smallest_uint_t<1337>; // std::uint16_t diff --git a/include/stdx/bit.hpp b/include/stdx/bit.hpp index 657f555..58c8ff5 100644 --- a/include/stdx/bit.hpp +++ b/include/stdx/bit.hpp @@ -421,13 +421,13 @@ template constexpr auto bit_size() -> std::size_t { template CONSTEVAL auto smallest_uint() { if constexpr (N <= std::numeric_limits::digits) { - return std::uint8_t{}; + return std::uint8_t{N}; } else if constexpr (N <= std::numeric_limits::digits) { - return std::uint16_t{}; + return std::uint16_t{N}; } else if constexpr (N <= std::numeric_limits::digits) { - return std::uint32_t{}; + return std::uint32_t{N}; } else { - return std::uint64_t{}; + return std::uint64_t{N}; } }