mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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:
1 parent
e272637d5e
commit
2c36ffec46
1 file changed
+2
-2
+2
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user