Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] About `packed_channel_value` (possible improvement)
From: Christian Henning (chhenning_at_[hidden])
Date: 2013-02-13 12:45:52


Hi,

>
> packed_channel_value(integer_t v) { _value = static_cast< integer_t >( v
> % num_values ); }
>
> // I have no idea why this exists, seems OK to remove it
> template <typename Scalar> packed_channel_value(Scalar v) { _value =
> static_cast< integer_t >( v ) % num_values; }

I always thought we need that but some testing shows it's not needed.
I'll remove it.

>
> IIUC, "v % num_values" above could be replaced with a much cheaper "v &
> low_bits_mask_t<NumBits>::sig_bits_fast".
> That is:
>
> packed_channel_value(integer_t v) : _value(v &
> low_bits_mask_t<NumBits>::sig_bits_fast) {}
>
> What do you think? Am I missing some point?

I think, you're correct and I always wondered why we need num_values
and num_value_t. I think it's obsolete and might have been created
before low_bits_mask_t was available or the developers didn't knew
about it. In any event I'll update the trunk later. First I wanna make
sure the gil tests run through.

Please let me know if you find any more redundancies. I'm happy to fix that.

Thanks again,
Christian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net