Short Vector Library
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
The Short Vector Library provides types similar to the Vector Type defined in HLSL. A short vector provides definitions that are useful for programming short vectors generically.
Any unary or binary operation which is overloadable and valid between two C++ numerical types is valid for the short vector types. For binary operators, the two vectors must have the same size and the result is a vector of the same size. The operators are described in the following table.
Binary operators 
All types: +, , *, /, Integer types: %, ^, , &, <<, >> 
Relational operators 
== and != 
Compound assignment operator 
All types: +=, =, *=, /= Integer types: %=, ^=, =, &=, <<=, >>= 
Increment and decrement operators 
Integer types only: ++, , both prefix and postfix. 
Bitwise NOT operator (~) 
Integer types only. 
Unary  operator 
All types except unorm and uint types. 


The norm and unorm types are scalar types that limit the range of float values, called clamping. These types can be explicitly constructed from other scalar types. In casting, the value is first cast to float then clamped to the respective region allowed by norm [1.0…1.0] or unorm [0.0…1.0]. Casting from +/ infinity returns +=1. Casting from NaN is undefined. A norm can be implicitly constructed from a unorm and there is no loss of data. The implicit conversion operator to float is defined on these types. Binary operators are defined between these types and other builtin scalar types such as float and int: +, , *, /, ==, !=, >, <, >=, <=. The compound assignment operators are also supported: +=, =, *=, /=. The unary negation operator () is defined for norm types.
The Short Vector Library supports the vector_type.identifier accessor to access the components of a short vector. (Indexing of the vector is not supported.) The identifier, known as a swizzling expression, specifies the components of the vector. The expression can be an lvalue or an rvalue. Individual characters in indent may be: x,y,z,w,r,g,b,a,0,1. “x” means zeroth component, “y” means first, etc., and rgba is synonymous for xyzw. 0 and 1 return a constant 0 and 1. Single component accessors, such as “x”, “y”, etc., return a value type. Multicomponent accessors return a short vector type. The following table shows some swizzling expressions and their indexed equivalents. (Note that indexing is not supported. The indexing is used for explanation purposes.)
Swizzling expression 
Index expression 

double4 va = myDouble2.y0x1; 
double4 va(myDouble2[1], 0, myDouble2[0], 1); 
double4 vb = myDouble4.xxww; 
double4 vb(myDouble4[0], myDouble4[0], myDouble4[3], myDouble2[3]); 
double4 vc = myDouble3.rgb1; 
double4 vc(myDouble3[0], myDouble4[1], myDouble4[2], 1); 

