deps: update nbytes to 0.1.3

PR-URL: https://github.com/nodejs/node/pull/61879
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Node.js GitHub Bot authored and GitHub committed 2026-02-20 21:57:52 +00:00
1 parent 94df36a121
commit 4e9877f73d
7 files changed
+57 -8

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
{
".": "0.1.3"
}
+8
View File
@@ -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))
+14 -1
View File
@@ -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
)
+4 -4
View File
@@ -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
+10
View File
@@ -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}
+11
View File
@@ -0,0 +1,11 @@
{
"packages": {
".": {
"release-type": "simple",
"extra-files": [
"CMakeLists.txt",
"include/nbytes.h"
]
}
}
}
+7 -3
View File
@@ -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<size_t>(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<uint8_t>(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;