24-bit int
Ilya via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Sep 3 21:33:40 PDT 2017
On Sunday, 3 September 2017 at 23:30:43 UTC, EntangledQuanta
wrote:
> On Sunday, 3 September 2017 at 04:01:34 UTC, Ilya Yaroshenko
> wrote:
>> On Saturday, 2 September 2017 at 03:29:20 UTC, EntangledQuanta
>> wrote:
>>> On Saturday, 2 September 2017 at 02:49:41 UTC, Ilya
>>> Yaroshenko wrote:
>>>> [...]
>>>
>>> Thanks. Seems useful.
>>
>> Just added `bytegroup` topology. Released in v0.6.12 (will be
>> available in DUB after few minutes.)
>>
>> http://docs.algorithm.dlang.io/latest/mir_ndslice_topology.html#bytegroup
>>
>> It is faster for your task then `bitpack`.
>>
>> Best regards,
>> Ilya
>
> Thanks! I might end up using this. Is this basically just a
> logical mapping(cast(int)bytes[i*3]) & 0xFFFFFF) type of stuff
> or is there more of a performance hit?
>
> I could do the mapping myself if that is the case as I do not
> need much of a general solution. I'll probably be using in a
> just a few lines of code. It just needs to be nearly as fast as
> direct access.
The implementation can be found here
https://github.com/libmir/mir-algorithm/blob/master/source/mir/ndslice/iterator.d
It uses unions and byte loads. The speed should be almost the
same as direct access.
More information about the Digitalmars-d-learn
mailing list