File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -1074,6 +1074,7 @@ class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> {
10741074
10751075 // Reads 1 to 3 bytes from p. Zero pads to fill uint32_t.
10761076 static uint32_t Read1To3 (const unsigned char * p, size_t len) {
1077+ // The trick used by this implementation is to avoid branches if possible.
10771078 unsigned char mem0 = p[0 ];
10781079 unsigned char mem1 = p[len / 2 ];
10791080 unsigned char mem2 = p[len - 1 ];
@@ -1083,7 +1084,7 @@ class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> {
10831084 unsigned char significant0 = mem0;
10841085#else
10851086 unsigned char significant2 = mem0;
1086- unsigned char significant1 = mem1;
1087+ unsigned char significant1 = len == 2 ? mem0 : mem1;
10871088 unsigned char significant0 = mem2;
10881089#endif
10891090 return static_cast <uint32_t >(significant0 | //
You can’t perform that action at this time.
0 commit comments