
3 Jun
2010
3 Jun
'10
1:35 p.m.
Your code could be as efficient as using Tomas' swap(), but not swap_in_place(), I think. Measurements are good.
Good prediction! The type-based code is more efficient than Tomas' swap() but less efficient than swap_in_place.
That is surprising. swap() should have no overhead compared to the endian object types. Then again, it's very early code, and I've done no optimization yet. It could be something as simply as an "inline" missing.
Both approaches are equally efficient for the same-endian case.
Do you mean endian object and swap_in_place or endian object and swap? Tom