Small Vectors Proposal
Chad J
gamerChad at _spamIsBad_gmail.com
Tue Jan 30 21:15:30 PST 2007
Another thing I realized it would be nice to have is some intrinsic
functions.
Here are some things I can think of off hand:
/// Saturated componentwise addition of two vectors.
adds( T vector1, T vector2 );
/// Multiply Add.
madd( T vector1, T vector2 );
/// Shifts all bits in "vector" right or left, respectively.
shiftr( T vector );
shiftl( T vector );
/** Comparison routines that return masks.
Compare the operands in the appropriate way. If the comparison is
true for a particular set of components, the resulting component
will be filled with all 1's, otherwise it will be filled with all
0's.
These should be hardware defined CPUs with SSEs and MMX, which are
used on most desktops today and probably for a looong time.
*/
compareLess( T vector1, T vector2 ); // returns vector1 < vector2
compareLessEquals( T vector1, T vector2 ); // returns vector1 <= vector2
compareGreater( T vector1, T vector2 ); // returns vector1 > vector2
... (you get the idea)
I'm looking forward to some slick SIMD support in D! I'm getting
excited just to see this considered. *stoked*
Oh and speaking of intrinsics, std.intrinsics is lacking the kinda
obvious rotate left and rotate right (rol/ror) :(
More information about the Digitalmars-d
mailing list