Changeset 236 for cpp


Ignore:
Timestamp:
04/30/14 05:05:24 (10 years ago)
Author:
Maciej Komosinski
Message:

Changed binary literals to macros (some compilers do not support binary literals yet)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/geometry/geometryutils.h

    r193 r236  
    1010#include <frams/util/3d.h>
    1111#include <frams/util/list.h>
     12
     13//binary literals standardized in C++14
     14#define b000 0
     15#define b01 1
     16#define b001 1
     17#define b10 2
     18#define b010 2
     19#define b100 4
     20#define b110 6
    1221
    1322namespace CuboidFaces
     
    2534        };
    2635       
    27         inline bool isPositive(Face f) { return f & 0b001; }
     36        inline bool isPositive(Face f) { return f & b001; }
    2837        inline bool isNegative(Face f) { return !isPositive(f); }
    29         inline bool isX(Face f) { return (f & 0b110) == 0b000; }
    30         inline bool isY(Face f) { return (f & 0b110) == 0b010; }
    31         inline bool isZ(Face f) { return (f & 0b110) == 0b100; }
     38        inline bool isX(Face f) { return (f & b110) == b000; }
     39        inline bool isY(Face f) { return (f & b110) == b010; }
     40        inline bool isZ(Face f) { return (f & b110) == b100; }
    3241}
    3342
     
    4251        };
    4352       
    44         inline bool isPositive(Base b) { return b & 0b001; }
     53        inline bool isPositive(Base b) { return b & b001; }
    4554        inline bool isNegative(Base b) { return !isPositive(b); }
    4655}
     
    5867        };
    5968       
    60         inline bool isPositiveX(QuadrantXY q) { return q & 0b10; }
     69        inline bool isPositiveX(QuadrantXY q) { return q & b10; }
    6170        inline bool isNegativeX(QuadrantXY q) { return !isPositiveX(q); }
    62         inline bool isPositiveY(QuadrantXY q) { return q & 0b01; }
     71        inline bool isPositiveY(QuadrantXY q) { return q & b01; }
    6372        inline bool isNegativeY(QuadrantXY q) { return !isPositiveY(q); }
    6473}
     
    7685        };
    7786       
    78         inline bool isPositiveY(QuadrantYZ q) { return q & 0b10; }
     87        inline bool isPositiveY(QuadrantYZ q) { return q & b10; }
    7988        inline bool isNegativeY(QuadrantYZ q) { return !isPositiveY(q); }
    80         inline bool isPositiveZ(QuadrantYZ q) { return q & 0b01; }
     89        inline bool isPositiveZ(QuadrantYZ q) { return q & b01; }
    8190        inline bool isNegativeZ(QuadrantYZ q) { return !isPositiveZ(q); }
    8291}
     
    94103        };
    95104       
    96         inline bool isPositiveZ(QuadrantZX q) { return q & 0b10; }
     105        inline bool isPositiveZ(QuadrantZX q) { return q & b10; }
    97106        inline bool isNegativeZ(QuadrantZX q) { return !isPositiveZ(q); }
    98         inline bool isPositiveX(QuadrantZX q) { return q & 0b01; }
     107        inline bool isPositiveX(QuadrantZX q) { return q & b01; }
    99108        inline bool isNegativeX(QuadrantZX q) { return !isPositiveX(q); }
    100109}
     
    116125        };
    117126       
    118         inline bool isPositiveX(Octant o) { return o & 0b100; }
     127        inline bool isPositiveX(Octant o) { return o & b100; }
    119128        inline bool isNegativeX(Octant o) { return !isPositiveX(o); }
    120         inline bool isPositiveY(Octant o) { return o & 0b010; }
     129        inline bool isPositiveY(Octant o) { return o & b010; }
    121130        inline bool isNegativeY(Octant o) { return !isPositiveY(o); }
    122         inline bool isPositiveZ(Octant o) { return o & 0b001; }
     131        inline bool isPositiveZ(Octant o) { return o & b001; }
    123132        inline bool isNegativeZ(Octant o) { return !isPositiveZ(o); }
    124133}
Note: See TracChangeset for help on using the changeset viewer.