primitive vector types (permutation syntax)
Don
nospam at nospam.com
Mon Feb 23 00:06:31 PST 2009
Mattias Holm wrote:
> I think that the following would work reasonably well:
>
> allow the [] operator for arrays to take comma separated lists of
> indices.
I've always believed that we need that syntax for multi-dimensional
arrays. Swizzling ought to be possible on a multi-dimensional array, and
I don't think it would be, with your proposal?
>
> So the OpenCL like statement:
>
> v.xyzw = v2.wzyx;
>
> will be written as:
>
> v[0,1,2,3] = v2[3,2,1,0];
>
> Would this be ok? This is a general extension of the array slicing, and
> it might be possible to permute with a combination of slices and indices
> like this (i.e. v[0..3, 6, 5, 7.. len]). Is permutation operations
> something that Walter would be willing to add?
>
> As said by someone else in this thread, there need to be a way to
> specify that static arrays are passed by value, so can the ref keyword
> be paired with the oposite "byval" or something similar.
>
> And also, functions need to be able to return static arrays which is not
> possible at the moment.
>
> Note that the support should be general and work with any array type (so
> that you can get YMM support whenever that makes it into the future chips).
>
>
> / Mattias
>
More information about the Digitalmars-d
mailing list