Skip to content
Snippets Groups Projects
Commit fe1a2bb1 authored by Christos Anastopoulos's avatar Christos Anastopoulos Committed by Tadej Novak
Browse files

BFieldCache Change the code so as to emit more clang like assembly for gcc

BFieldCache Change the code so as to emit more clang like assembly for gcc
parent 985858f1
No related merge requests found
......@@ -57,7 +57,11 @@ BFieldCache::inside(double z, double r, double phi) const
if (phi < m_phimin) {
phi += 2.0 * M_PI;
}
return (z <= m_zmax && z >= m_zmin && r <= m_rmax && r >= m_rmin &&
phi <= m_phimax && phi >= m_phimin);
// clang emits code that is more similar to using the "bit AND"
// rather than "logical AND" for this kind of check.
// Basically get rid of jmp instructions with calculating
// a bit more
return ((z <= m_zmax) & (z >= m_zmin) & (r <= m_rmax) & (r >= m_rmin) &
(phi <= m_phimax) & (phi >= m_phimin));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment