buffer: use constexpr where possible

PR-URL: https://github.com/nodejs/node/pull/58141
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
This commit is contained in:
Yagiz Nizipli authored and GitHub committed 2025-05-06 16:53:37 +00:00
1 parent e272637d5e
commit 2c36ffec46
1 file changed
+2 -2
+2 -2
View File
@@ -1452,9 +1452,9 @@ uint32_t WriteOneByteString(const char* src,
return 0;
}
if (encoding == UTF8) {
if constexpr (encoding == UTF8) {
return simdutf::convert_latin1_to_utf8_safe(src, src_len, dst, dst_len);
} else if (encoding == LATIN1 || encoding == ASCII) {
} else if constexpr (encoding == LATIN1 || encoding == ASCII) {
const auto size = std::min(src_len, dst_len);
memcpy(dst, src, size);
return size;