Boost logo

Boost :

Subject: Re: [boost] [dynamic_bitset] Endianess and Adaption Vs Copying
From: Francois Duranleau (xiao.bai.xiong_at_[hidden])
Date: 2012-05-01 17:07:24


On Tue, May 1, 2012 at 4:35 PM, Joel <jdy_at_[hidden]> wrote:
>
> I've noticed that the dynamic_bitset seems to have endian issues.  For masking
> out the ith bit in a block, it uses 1 shifted left by i.  As a result, the bits
> are not consecutive.
>
> For example if the block_type is uint8_t, and we have 16 bits in the bitset,
> then bits are numbered:
>
> 00 01 02 03 04 05 06 07 15 14 13 12 11 10 09 08
>
> in memory.

Wrong, in increasing address order, it would rather be

07 06 05 04 03 02 01 00 15 14 13 12 11 10 09 08

>  That doesn't seem right---7th and 8th bits should be adjacent.  Does
> anyone have suggestions for controlling this?

Why? How is that a problem?

> Second, has anyone adapted dynamic_bitset to be an adaptor for an existing
> memory range to avoid copying?

I haven't, but it sounds like a good idea :)

-- 
François

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