color lib

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 9 04:39:45 PDT 2016


On Sunday, 9 October 2016 at 08:39:57 UTC, Nicholas Wilson wrote:
> 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

static foreach can help for static arrays. For example, ndslice 
uses static foreach a lot. mir.ndslice.algorithm allows to 
perform vectorized operations. Some conversion algorithms for 
ndslices will be added to Mir or DCV. Please open a pool request 
or fill an issue.


More information about the Digitalmars-d mailing list