We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


Microsoft Specific

Emits the x64 extended version of the Convert with Truncation Single-Precision Floating-Point Number to 64-Bit Integer (cvttss2si) instruction.

__int64 _mm_cvttss_si64x( 
   __m128 value 

[in] value

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

The result of the conversion of the first floating-point value to a 64-bit integer.





Header file <intrin.h>

The intrinsic differs from _mm_cvtss_si64x only in that inexact conversions are truncated toward zero. 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_cvttss_si64x.cpp
// processor: x64
#include <intrin.h>
#include <stdio.h>

#pragma intrinsic(_mm_cvttss_si64x)

int main()
    __m128 a;
    __int64 b = 54;

    // _mm_load_ps requires an aligned buffer.
    __declspec(align(16)) float af[4] = { 101.5, 200.75,
                                          300.5, 400.5 };

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

    // Extract the first element of a and convert to an integer
    b = _mm_cvttss_si64x(a);

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