From 316b4c26b5dd147773883c67dd6708d7b71c9d2a Mon Sep 17 00:00:00 2001 From: ChALkeR <291301+ChALkeR@users.noreply.github.com> Date: Wed, 18 Feb 2026 21:53:15 +0000 Subject: [PATCH] deps: update nbytes to 0.1.3 --- deps/nbytes/.release-please-manifest.json | 3 +++ deps/nbytes/CHANGELOG.md | 8 ++++++++ deps/nbytes/CMakeLists.txt | 15 ++++++++++++++- deps/nbytes/include/nbytes.h | 8 ++++---- deps/nbytes/nbytes.pc.in | 10 ++++++++++ deps/nbytes/release-please-config.json | 11 +++++++++++ deps/nbytes/src/nbytes.cpp | 10 +++++++--- 7 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 deps/nbytes/.release-please-manifest.json create mode 100644 deps/nbytes/CHANGELOG.md create mode 100644 deps/nbytes/nbytes.pc.in create mode 100644 deps/nbytes/release-please-config.json diff --git a/deps/nbytes/.release-please-manifest.json b/deps/nbytes/.release-please-manifest.json new file mode 100644 index 00000000000000..c05df9b5541987 --- /dev/null +++ b/deps/nbytes/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.3" +} diff --git a/deps/nbytes/CHANGELOG.md b/deps/nbytes/CHANGELOG.md new file mode 100644 index 00000000000000..067a946eb30cbd --- /dev/null +++ b/deps/nbytes/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +## [0.1.3](https://github.com/nodejs/nbytes/compare/v0.1.2...v0.1.3) (2026-02-18) + + +### Bug Fixes + +* use arithmetic HexEncode instead of lookups ([#12](https://github.com/nodejs/nbytes/issues/12)) ([8011baf](https://github.com/nodejs/nbytes/commit/8011baff1dfecf48b5feca21cb29b72e3562c919)) diff --git a/deps/nbytes/CMakeLists.txt b/deps/nbytes/CMakeLists.txt index f2efa3c52ba1d1..5ac0e31aaa4fce 100644 --- a/deps/nbytes/CMakeLists.txt +++ b/deps/nbytes/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.28) -project(nbytes) +project(nbytes VERSION 0.1.3) # x-release-please-version set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -40,3 +40,16 @@ install( ARCHIVE COMPONENT nbytes_development INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) + +# Configure and install pkg-config file +configure_file( + "${PROJECT_SOURCE_DIR}/nbytes.pc.in" + "${PROJECT_BINARY_DIR}/nbytes.pc" + @ONLY +) + +install( + FILES "${PROJECT_BINARY_DIR}/nbytes.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" + COMPONENT nbytes_development +) diff --git a/deps/nbytes/include/nbytes.h b/deps/nbytes/include/nbytes.h index 525a91735c954a..3a2bcc605bfa58 100644 --- a/deps/nbytes/include/nbytes.h +++ b/deps/nbytes/include/nbytes.h @@ -836,12 +836,12 @@ size_t SearchString(const char *haystack, size_t haystack_length, // ============================================================================ // Version metadata -#define NBYTES_VERSION "0.1.1" +#define NBYTES_VERSION "0.1.3" // x-release-please-version enum { - NBYTES_VERSION_MAJOR = 0, - NBYTES_VERSION_MINOR = 1, - NBYTES_VERSION_REVISION = 1, + NBYTES_VERSION_MAJOR = 0, // x-release-please-major + NBYTES_VERSION_MINOR = 1, // x-release-please-minor + NBYTES_VERSION_REVISION = 3, // x-release-please-patch }; } // namespace nbytes diff --git a/deps/nbytes/nbytes.pc.in b/deps/nbytes/nbytes.pc.in new file mode 100644 index 00000000000000..24119b190e69e6 --- /dev/null +++ b/deps/nbytes/nbytes.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: nbytes +Description: Library of byte handling functions extracted from Node.js core +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lnbytes +Cflags: -I${includedir} diff --git a/deps/nbytes/release-please-config.json b/deps/nbytes/release-please-config.json new file mode 100644 index 00000000000000..079304597b6d88 --- /dev/null +++ b/deps/nbytes/release-please-config.json @@ -0,0 +1,11 @@ +{ + "packages": { + ".": { + "release-type": "simple", + "extra-files": [ + "CMakeLists.txt", + "include/nbytes.h" + ] + } + } +} diff --git a/deps/nbytes/src/nbytes.cpp b/deps/nbytes/src/nbytes.cpp index a827809adbacd3..09e2665f8c67e4 100644 --- a/deps/nbytes/src/nbytes.cpp +++ b/deps/nbytes/src/nbytes.cpp @@ -157,6 +157,11 @@ const int8_t unhex_table[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; +inline constexpr char nibble(uint8_t x) { + uint8_t add = (x >= 10) ? ('a' - 10) : '0'; + return x + add; +} + size_t HexEncode(const char *src, size_t slen, char *dst, size_t dlen) { // We know how much we'll write, just make sure that there's space. NBYTES_ASSERT_TRUE(dlen >= MultiplyWithOverflowCheck(slen, 2u) && @@ -164,10 +169,9 @@ size_t HexEncode(const char *src, size_t slen, char *dst, size_t dlen) { dlen = slen * 2; for (size_t i = 0, k = 0; k < dlen; i += 1, k += 2) { - static const char hex[] = "0123456789abcdef"; uint8_t val = static_cast(src[i]); - dst[k + 0] = hex[val >> 4]; - dst[k + 1] = hex[val & 15]; + dst[k + 0] = nibble(val >> 4); + dst[k + 1] = nibble(val & 15); } return dlen;