Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 75c8e18

Browse filesBrowse files
nodejs-github-botaduh95
authored andcommitted
deps: update nbytes to 0.1.3
PR-URL: #61879 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 89318b0 commit 75c8e18
Copy full SHA for 75c8e18

7 files changed

+57-8Lines changed: 57 additions & 8 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.3"
3+
}
Collapse file

‎deps/nbytes/CHANGELOG.md‎

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
## [0.1.3](https://github.com/nodejs/nbytes/compare/v0.1.2...v0.1.3) (2026-02-18)
4+
5+
6+
### Bug Fixes
7+
8+
* use arithmetic HexEncode instead of lookups ([#12](https://github.com/nodejs/nbytes/issues/12)) ([8011baf](https://github.com/nodejs/nbytes/commit/8011baff1dfecf48b5feca21cb29b72e3562c919))
Collapse file

‎deps/nbytes/CMakeLists.txt‎

Copy file name to clipboardExpand all lines: deps/nbytes/CMakeLists.txt
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.28)
2-
project(nbytes)
2+
project(nbytes VERSION 0.1.3) # x-release-please-version
33

44
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -40,3 +40,16 @@ install(
4040
ARCHIVE COMPONENT nbytes_development
4141
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
4242
)
43+
44+
# Configure and install pkg-config file
45+
configure_file(
46+
"${PROJECT_SOURCE_DIR}/nbytes.pc.in"
47+
"${PROJECT_BINARY_DIR}/nbytes.pc"
48+
@ONLY
49+
)
50+
51+
install(
52+
FILES "${PROJECT_BINARY_DIR}/nbytes.pc"
53+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
54+
COMPONENT nbytes_development
55+
)
Collapse file

‎deps/nbytes/include/nbytes.h‎

Copy file name to clipboardExpand all lines: deps/nbytes/include/nbytes.h
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,12 +836,12 @@ size_t SearchString(const char *haystack, size_t haystack_length,
836836

837837
// ============================================================================
838838
// Version metadata
839-
#define NBYTES_VERSION "0.1.1"
839+
#define NBYTES_VERSION "0.1.3" // x-release-please-version
840840

841841
enum {
842-
NBYTES_VERSION_MAJOR = 0,
843-
NBYTES_VERSION_MINOR = 1,
844-
NBYTES_VERSION_REVISION = 1,
842+
NBYTES_VERSION_MAJOR = 0, // x-release-please-major
843+
NBYTES_VERSION_MINOR = 1, // x-release-please-minor
844+
NBYTES_VERSION_REVISION = 3, // x-release-please-patch
845845
};
846846

847847
} // namespace nbytes
Collapse file

‎deps/nbytes/nbytes.pc.in‎

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=${prefix}
3+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
4+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
5+
6+
Name: nbytes
7+
Description: Library of byte handling functions extracted from Node.js core
8+
Version: @PROJECT_VERSION@
9+
Libs: -L${libdir} -lnbytes
10+
Cflags: -I${includedir}
Collapse file
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "simple",
5+
"extra-files": [
6+
"CMakeLists.txt",
7+
"include/nbytes.h"
8+
]
9+
}
10+
}
11+
}
Collapse file

‎deps/nbytes/src/nbytes.cpp‎

Copy file name to clipboardExpand all lines: deps/nbytes/src/nbytes.cpp
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,21 @@ const int8_t unhex_table[256] = {
157157
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
158158
-1, -1, -1, -1, -1, -1, -1, -1, -1};
159159

160+
inline constexpr char nibble(uint8_t x) {
161+
uint8_t add = (x >= 10) ? ('a' - 10) : '0';
162+
return x + add;
163+
}
164+
160165
size_t HexEncode(const char *src, size_t slen, char *dst, size_t dlen) {
161166
// We know how much we'll write, just make sure that there's space.
162167
NBYTES_ASSERT_TRUE(dlen >= MultiplyWithOverflowCheck<size_t>(slen, 2u) &&
163168
"not enough space provided for hex encode");
164169

165170
dlen = slen * 2;
166171
for (size_t i = 0, k = 0; k < dlen; i += 1, k += 2) {
167-
static const char hex[] = "0123456789abcdef";
168172
uint8_t val = static_cast<uint8_t>(src[i]);
169-
dst[k + 0] = hex[val >> 4];
170-
dst[k + 1] = hex[val & 15];
173+
dst[k + 0] = nibble(val >> 4);
174+
dst[k + 1] = nibble(val & 15);
171175
}
172176

173177
return dlen;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.