Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
_mm_cvt_ss2si
Collapse the table of content
Expand the table of content

_mm_cvt_ss2si

Microsoft Specific

Generates the Convert Single-Precision Floating-Point Value to Doubleword Integer (cvtss2si) instruction.


int _mm_cvt_ss2si( 
   __m128 value 
);

Parameters

[in] value

An __m128 structure containing four single-precision floating-point values.

An integer representing the result of the conversion.

Intrinsic Architecture

_mm_cvt_ss2si

x86 with SSE2, x64

Header file <intrin.h>

The integer is rounded according to the rounding control bits in MXCSR. The default rounding mode is round-to-nearest, rounding to the even number if the decimal part is 0.5. If an overflow occurs, 0x80000000 is returned. The __m128 structure represents an XMM register, so this intrinsic allows a value from the XMM register to be moved into system memory.

This routine is only available as an intrinsic.

// _mm_cvt_ss2si.cpp
// processor: x86, x64
#include <intrin.h>
#include <stdio.h>

#pragma intrinsic(_mm_cvt_ss2si)

int main()
{
    __m128 a;
    int b;

    float af[4] = { 101.25, 200.75,300.5, 400.5 };

    // Load a with the floating point values.
    // The values will be copied to the XMM registers.
    a = _mm_loadu_ps(af);

    // Extract the first element of a
    b = _mm_cvt_ss2si(a);

    printf_s("%d\n", b );
}

Output

101

Community Additions

ADD
Show:
© 2015 Microsoft