Edit

Share via


XMVectorSum function (directxmath.h)

Computes the horizontal sum of the components of an XMVECTOR. The horizontal sum is the result of adding each component in the vector together.

Syntax

XMVECTOR XM_CALLCONV XMVectorSum(
  [in] FXMVECTOR V
) noexcept;

Parameters

[in] V

Vector for which to compute the horizontal sum.

Return value

Returns a vector whose components are the horizontal sum of the components of V.

Remarks

Note that for SSE/SSE2, horizonal sums require a number of math and shuffle operations. If you enable SSE3 (via defining _XM_SSE3_INTRINSICS_, /arch:AVX, or /arch:AVX2) -or- if using Windows on ARM/ARM64, this function can make use of horizonal sum intrinsics.

This is new to DirectXMath 3.10

Requirements

Requirement Value
Target Platform Windows
Header directxmath.h (include DirectXMath.h)

See also

Vector Arithmetic Functions