Commit f5d25606 authored by Jan Möbius's avatar Jan Möbius
Browse files

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
parent 6afadfbd
......@@ -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
......
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