Skip to content

Commit

Permalink
Fix -Wbitwise-instead-of-logical in 5 files starting w/ fbpcs/emp_gam…
Browse files Browse the repository at this point in the history
…es/pcf2_attribution/AttributionRule_impl.h (#9310)

Summary:
X-link: facebook/hhvm#9310

X-link: facebookincubator/dynolog#89

Pull Request resolved: facebookresearch#462

X-link: facebookresearch/fbpcs#2016

With LLVM-15, `&&` and `||` are required for boolean operands, rather than `&` and `|` which can be confused for bitwise operations. Fixing such ambiguity helps makes our code more readable.

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Differential Revision: D42347735

fbshipit-source-id: 44d51851a630d42e8bf9f6a72949399264384e8e
  • Loading branch information
r-barnes authored and facebook-github-bot committed Jan 7, 2023
1 parent 7c0d5eb commit c5a19ef
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fbpcf/engine/SecretShareEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,13 +749,13 @@ SecretShareEngine::computeExecutionResultsFromOpenedShares(

for (size_t i = 0; i < ands.size(); i++) {
bool val = normalTuples.at(normalTupleIndex).getC() ^
(openedSecrets.at(2 * normalTupleIndex) &
(openedSecrets.at(2 * normalTupleIndex) &&
normalTuples.at(normalTupleIndex).getB()) ^
(openedSecrets.at(2 * normalTupleIndex + 1) &
(openedSecrets.at(2 * normalTupleIndex + 1) &&
normalTuples.at(normalTupleIndex).getA());
if (myId_ == 0) {
val = val ^
(openedSecrets.at(2 * normalTupleIndex) &
(openedSecrets.at(2 * normalTupleIndex) &&
openedSecrets.at(2 * normalTupleIndex + 1));
}
andResults.push_back(val);
Expand All @@ -768,13 +768,13 @@ SecretShareEngine::computeExecutionResultsFromOpenedShares(
std::vector<bool> rst(batchSize);
for (int j = 0; j < batchSize; j++) {
bool val = normalTuples.at(normalTupleIndex).getC() ^
(openedSecrets.at(2 * normalTupleIndex) &
(openedSecrets.at(2 * normalTupleIndex) &&
normalTuples.at(normalTupleIndex).getB()) ^
(openedSecrets.at(2 * normalTupleIndex + 1) &
(openedSecrets.at(2 * normalTupleIndex + 1) &&
normalTuples.at(normalTupleIndex).getA());
if (myId_ == 0) {
val = val ^
(openedSecrets.at(2 * normalTupleIndex) &
(openedSecrets.at(2 * normalTupleIndex) &&
openedSecrets.at(2 * normalTupleIndex + 1));
}
rst[j] = val;
Expand Down Expand Up @@ -829,7 +829,7 @@ SecretShareEngine::computeExecutionResultsFromOpenedShares(
(openedSecrets.at(secretIndex) && tuple.getA());
if (myId_ == 0) {
val = val ^
(openedSecrets.at(leftSecretIndex) &
(openedSecrets.at(leftSecretIndex) &&
openedSecrets.at(secretIndex));
}
compositeResult[k][j] = val;
Expand Down

0 comments on commit c5a19ef

Please sign in to comment.