Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Microsoft Specific

Generates the Convert with Truncation Scalar Single-Precision Floating-Point Value to Doubleword Integer (cvttss2si) instruction.

int _mm_cvtt_ss2si( 
   __m128 value 


[in] value

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

An integer representing the result of the conversion.

Intrinsic Architecture


x86 with SSE2, x64

Header file <intrin.h>

The first element of the input structure value is converted to an integer and returned. Because the __m128 structure represents an XMM register, the instruction generated moves data from an XMM register into system memory.

This routine is only available as an intrinsic.

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

#pragma intrinsic(_mm_cvtt_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_cvtt_ss2si(a);

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


© 2016 Microsoft