Commit 154d03a2 authored by Anton Gladky's avatar Anton Gladky
Browse files

Reduce size of flags in Bounds of InsertionSortCollider

Replace unsigned by bool. Size changed from 4 to 1 byte.
parent 0a59da52
...@@ -78,9 +78,7 @@ class Integrator; ...@@ -78,9 +78,7 @@ class Integrator;
class GeneralIntegratorInsertionSortCollider;// Forward decleration of child to decleare it as friend class GeneralIntegratorInsertionSortCollider;// Forward decleration of child to decleare it as friend
class InsertionSortCollider: public Collider{ class InsertionSortCollider: public Collider{
friend class GeneralIntegratorInsertionSortCollider; friend class GeneralIntegratorInsertionSortCollider;
//! struct for storing bounds of bodies //! struct for storing bounds of bodies
struct Bounds{ struct Bounds{
//! coordinate along the given sortAxis //! coordinate along the given sortAxis
...@@ -90,7 +88,7 @@ class InsertionSortCollider: public Collider{ ...@@ -90,7 +88,7 @@ class InsertionSortCollider: public Collider{
//! periodic cell coordinate //! periodic cell coordinate
int period; int period;
//! is it the minimum (true) or maximum (false) bound? //! is it the minimum (true) or maximum (false) bound?
struct{ unsigned hasBB:1; unsigned isMin:1; } flags; struct {bool hasBB:true, isMin:true;} flags;
Bounds(Real coord_, Body::id_t id_, bool isMin): coord(coord_), id(id_), period(0){ flags.isMin=isMin; } Bounds(Real coord_, Body::id_t id_, bool isMin): coord(coord_), id(id_), period(0){ flags.isMin=isMin; }
bool operator<(const Bounds& b) const { bool operator<(const Bounds& b) const {
/* handle special case of zero-width bodies, which could otherwise get min/max swapped in the unstable std::sort */ /* handle special case of zero-width bodies, which could otherwise get min/max swapped in the unstable std::sort */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment