Export (0) Print
Expand All
Expand Minimize


Microsoft Specific

Generates the x64 extended form of the Convert Scalar Double-Precision Floating-Point Value to 64-Bit Integer (cvtsd2si) instruction, which takes the double in the first element of value and converts it to a 64-bit integer.

__int64 _mm_cvtsd_si64x( 
   __m128d value 


[in] value

An __m128d structure containing two double-precision floating-point values.

An integer representing the result of the conversion.

Intrinsic Architecture



Header file <intrin.h>

The rounding control bits in MXCSR are used to determine the rounding behavior. The default rounding mode is round to nearest, rounding to the even number if the decimal part is 0.5. If an overflow occurs, 0x8000000000000000 (9223372036854775808) 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_cvtsd_si64x.cpp
// processor: x64
#include <intrin.h>
#include <stdio.h>

#pragma intrinsic(_mm_cvtsd_si64x)

int main()
    __m128d d;
    __int64 b;

    double adbl[2] = { 1.8E6, 200.5 };

    // Loads the double values into d
    // (moves data into the XMM registers)
    d = _mm_loadu_pd (adbl);

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

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



Community Additions

© 2014 Microsoft