src: modernize likely/unlikely hints

PR-URL: https://github.com/nodejs/node/pull/55155
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Yagiz Nizipli authored and GitHub committed 2024-09-30 18:04:16 +00:00
1 parent 3111ed7011
commit 317d2450f9
53 files changed
+287 -219

No files matched your search

+2 -2
View File
@@ -114,7 +114,7 @@ MaybeLocal<String> StringDecoder::DecodeData(Isolate* isolate,
state_[kMissingBytes] -= found_bytes;
state_[kBufferedBytes] += found_bytes;
if (LIKELY(MissingBytes() == 0)) {
if (MissingBytes() == 0) [[likely]] {
// If no more bytes are missing, create a small string that we
// will later prepend.
if (!MakeString(isolate,
@@ -132,7 +132,7 @@ MaybeLocal<String> StringDecoder::DecodeData(Isolate* isolate,
// It could be that trying to finish the previous chunk already
// consumed all data that we received in this chunk.
if (UNLIKELY(nread == 0)) {
if (nread == 0) [[unlikely]] {
body = !prepend.IsEmpty() ? prepend : String::Empty(isolate);
prepend = Local<String>();
} else {