2727
2828#include " iceberg/exception.h"
2929#include " iceberg/result.h"
30+ #include " iceberg/util/formatter.h" // IWYU pragma: keep
3031#include " iceberg/util/int128.h"
3132#include " iceberg/util/macros.h"
3233
@@ -70,7 +71,7 @@ inline Result<Uuid> ParseSimple(std::string_view s) {
7071 uint8_t h1 = kHexTable [static_cast <uint8_t >(s[i * 2 ])];
7172 uint8_t h2 = kHexTable [static_cast <uint8_t >(s[i * 2 + 1 ])];
7273
73- if ((h1 | h2) == 0xFF ) {
74+ if ((h1 | h2) == 0xFF ) [[unlikely]] {
7475 return InvalidArgument (" Invalid UUID string: {}" , s);
7576 }
7677
@@ -84,7 +85,7 @@ inline Result<Uuid> ParseHyphenated(std::string_view s) {
8485 ICEBERG_DCHECK (s.size () == 36 , " s must be 36 characters long" );
8586
8687 // Check that dashes are in the right places
87- if (!(s[8 ] == ' -' && s[13 ] == ' -' && s[18 ] == ' -' && s[23 ] == ' -' )) {
88+ if (!(s[8 ] == ' -' && s[13 ] == ' -' && s[18 ] == ' -' && s[23 ] == ' -' )) [[unlikely]] {
8889 return InvalidArgument (" Invalid UUID string: {}" , s);
8990 }
9091
@@ -98,7 +99,7 @@ inline Result<Uuid> ParseHyphenated(std::string_view s) {
9899 uint8_t h3 = kHexTable [static_cast <uint8_t >(s[i + 2 ])];
99100 uint8_t h4 = kHexTable [static_cast <uint8_t >(s[i + 3 ])];
100101
101- if ((h1 | h2 | h3 | h4) == 0xFF ) {
102+ if ((h1 | h2 | h3 | h4) == 0xFF ) [[unlikely]] {
102103 return InvalidArgument (" Invalid UUID string: {}" , s);
103104 }
104105
0 commit comments