More efficient implementation of opposite_halfedge handle
Old code compiled to 0x00000000004594a0 <+0>: lea -0x1(%rsi),%edx 0x00000000004594a3 <+3>: lea 0x1(%rsi),%eax 0x00000000004594a6 <+6>: and $0x1,%esi 0x00000000004594a9 <+9>: cmovne %edx,%eax 0x00000000004594ac <+12>: retq New code creates 0x00000000004594a0 <+0>: mov %esi,%eax 0x00000000004594a2 <+2>: xor $0x1,%eax 0x00000000004594a5 <+5>: retq So no conditionals, jumps and fewer instructions closes #5
This commit is contained in:
@@ -425,7 +425,7 @@ public:
|
||||
|
||||
|
||||
HalfedgeHandle opposite_halfedge_handle(HalfedgeHandle _heh) const
|
||||
{ return HalfedgeHandle((_heh.idx() & 1) ? _heh.idx()-1 : _heh.idx()+1); }
|
||||
{ return HalfedgeHandle(_heh.idx() ^ 1); }
|
||||
|
||||
|
||||
HalfedgeHandle ccw_rotated_halfedge_handle(HalfedgeHandle _heh) const
|
||||
|
||||
Reference in New Issue
Block a user