Small Vectors Proposal

janderson askme at me.com
Wed Jan 31 08:55:09 PST 2007


Walter Bright wrote:
> Thank you, this is in line with what I thought you meant. I'm glad I was 
> right. Your proposal is sensible and well thought out.
> 
> The only improvement I'd make is instead of:
> 
> float4 f;
> 
> Have:
> 
> float[4] f;
> 
> i.e. make static arrays of 2,3,4 dimensions have the suggested 
> properties. I think this is quite doable.


I think some of the properties could be used with multiple dimensions. 
SIMD could still be used efficiently on these higher orders (just repeat 
the operation when you run out).  This also opens up opportunities for 
parallel operations in the future.

Anything else could go in the standard library.

Swizzle is the odd one out.  It would have to be a special case. We can 
only support up to N characters with it, unless you do something fancy like:

float[8] value;
float[8] value2;

value.xyz = value2.x; //xyz in value are set to value2.x

value.xyz[xyz] = value2.x; //Sets both value[0-3] to xyz and value[4-7] 
to value2.x.

or

(value+4).xyz = value2.x;  //Just offset the array (value[4-7] are set 
to value2.x)

-Joel



More information about the Digitalmars-d mailing list