From c5a19ef7d3358b435d14e0867eb4f759d32ed21d Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Fri, 6 Jan 2023 16:21:36 -0800 Subject: [PATCH] Fix -Wbitwise-instead-of-logical in 5 files starting w/ fbpcs/emp_games/pcf2_attribution/AttributionRule_impl.h (#9310) Summary: X-link: https://github.com/facebook/hhvm/pull/9310 X-link: https://github.com/facebookincubator/dynolog/pull/89 Pull Request resolved: https://github.com/facebookresearch/fbpcf/pull/462 X-link: https://github.com/facebookresearch/fbpcs/pull/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 --- fbpcf/engine/SecretShareEngine.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fbpcf/engine/SecretShareEngine.cpp b/fbpcf/engine/SecretShareEngine.cpp index aefd0b09..a1cdf779 100644 --- a/fbpcf/engine/SecretShareEngine.cpp +++ b/fbpcf/engine/SecretShareEngine.cpp @@ -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); @@ -768,13 +768,13 @@ SecretShareEngine::computeExecutionResultsFromOpenedShares( std::vector 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; @@ -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;