|
Boost : |
Subject: Re: [boost] [Endian] Performance
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-09-06 09:42:42
On Tue, Sep 6, 2011 at 8:44 AM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> On 06/09/2011 00:38, Phil Endecott wrote:
>
>> #elif defined(USE_BEMAN)
>>
>> const char* s (reinterpret_cast<const char*>(&src));
>> uint32_t target;
>> char * t (reinterpret_cast<char*>(&target) + sizeof(target) - 1);
>> *t = *s;
>> *--t = *++s;
>> *--t = *++s;
>> *--t = *++s;
>> return target;
>
> Why isn't that just std::reverse?
Good question.
I don't really know the answer, but it may just be a legacy of very
old code that predates the availability of std::reverse.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk