color lib

Nicholas Wilson via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 9 01:39:57 PDT 2016


On Sunday, 9 October 2016 at 05:34:06 UTC, Ilya Yaroshenko wrote:
> On Sunday, 9 October 2016 at 05:21:32 UTC, Manu wrote:
>> On 9 October 2016 at 14:03, Nicholas Wilson via Digitalmars-d 
>> <digitalmars-d at puremagic.com> wrote:
>>> [...]
>>
>> Well the trouble is the lambda that you might give to 'map' 
>> won't work anymore. Operators don't work on batches, you need 
>> to use a completely different API, and I think that's 
>> unfortunate.
>
> Could you please give an example what type of operation should 
> be vectorized?

anything that is able to be. Given that ElementType!InBatchesOfN 
are a static array
of ElementType!(R), the compiler can* (assuming no branching and 
anything else that impedes vectorisation) combine most 
expressions into equivalent vector instruction.
This approach might not work so well for colours as is but should 
work if we "transpose" the colour i.e. rgbargbargbargba -> 
rrrrggggbbbbaaaa and then transpose it back.

*I know this is the sufficiently intelligent compiler argument


More information about the Digitalmars-d mailing list