Skip to content

Issue: Boolean condition uses & instead of && in boundary mapping branch #4995

@WeiqunZhang

Description

@WeiqunZhang
  • Type: Correctness risk / Maintainability
  • Severity: Low
  • Component: Non-local BC spherical mapping
  • Location: Src/Base/AMReX_NonLocalBCImpl.H:890

Problem

The branch condition is written as:

else if (imd && jmd & klo)

jmd and klo are booleans. Using bitwise & here is likely a typo from manual editing and is inconsistent with neighboring conditions that use &&.

Impact

  • Harder to read and easier to misinterpret in future edits.
  • No short-circuit semantics on the jmd & klo subexpression.
  • Increases risk of future copy-paste logic mistakes in this already branch-heavy routine.

Suggested patch

--- a/Src/Base/AMReX_NonLocalBCImpl.H
+++ b/Src/Base/AMReX_NonLocalBCImpl.H
@@
-        else if (imd && jmd & klo)
+        else if (imd && jmd && klo)

Prepared by Codex

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions