mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00: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:
@@ -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