Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian mini-review
From: Olaf van der Spek (ml_at_[hidden])
Date: 2015-01-23 18:25:09


On Fri, Jan 23, 2015 at 6:47 PM, Peter Dimov <lists_at_[hidden]> wrote:
> read( header& h )
> {
> unsigned char data[ 14 ];
> fread data from file;
>
> read_32_lsb( h.code, data + 0 );
> read_32_lsb( h.length, data + 4 );
> read_16_msb( h.version, data + 8 );
> read_32_lsb( h.shape_type, data + 10 );
> }

I've been looking for (standard) functions like that too, I think
they'd be very useful.
You'd probably want aligned variants too as they might offer better performance.

Also got a question about the name endian_reverse: wouldn't
reverse_endian make more sense?

-- 
Olaf

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk