MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / constant_compare

Function constant_compare

extra/yassl/src/yassl_imp.cpp:1056–1072  ·  view source on GitHub ↗

check all bytes for equality

Source from the content-addressed store, hash-verified

1054
1055// check all bytes for equality
1056static int constant_compare(const byte* a, const byte* b, int len)
1057{
1058 int good = 0;
1059 int bad = 0;
1060
1061 for (int i = 0; i < len; i++) {
1062 if (a[i] == b[i])
1063 good++;
1064 else
1065 bad++;
1066 }
1067
1068 if (good == len)
1069 return 0;
1070 else
1071 return 0 - bad; // failure
1072}
1073
1074
1075// check bytes for pad value

Callers 2

timing_verifyFunction · 0.85
ProcessMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected