Skip to content

Commit 95976e1

Browse files
swolchokfacebook-github-bot
authored andcommitted
Don't branch in tryReadFirstTwoBytesU64
Summary: We were trying to save an AND, but ANDs are essentially free so the work the generated code was doing to save the AND was not worth it. Reviewed By: davidtgoldblatt Differential Revision: D54504159 fbshipit-source-id: 3ccc7882123036d9616c5257cb8cd0c497f8dec7
1 parent fca24ab commit 95976e1

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

thrift/lib/cpp/util/VarintUtils-inl.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,8 @@ FOLLY_ALWAYS_INLINE bool tryReadFirstTwoBytesU64(
134134
// maximum size an encoded varint can be.
135135
DCHECK((p[0] & 0x80) != 0);
136136
uint64_t hi = p[1];
137-
if ((hi & 0x80) == 0) {
138-
result = (hi << 7) | (p[0] & 0x7f);
139-
return true;
140-
}
141137
result = ((hi & 0x7F) << 7) | (p[0] & 0x7f);
142-
return false;
138+
return (hi & 0x80) == 0;
143139
}
144140

145141
#if THRIFT_UTIL_VARINTUTILS_SIMD_DECODER

0 commit comments

Comments
 (0)