Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
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.


Microsoft Specific

Generates the x64 extended version of the Convert with Truncation Scalar Double-Precision Floating-Point Value to 64-Bit Integer (cvttsd2si) instruction, which takes the first double in the input structure of packed doubles, converts it to a 64-bit integer, and returns the result.

__int64 _mm_cvttsd_si64x( 
   __m128d value 

[in] value

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

The result of the conversion of the first double in the input to a 64-bit integer.





Header file <intrin.h>

The function differs from _mm_cvtsd_si64x only in that inexact conversions are truncated toward zero. If the result overflows, the value 0x8000000000000000 (-9223372036854775808) is returned. Because the __m128d 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_cvttsd_si64x.cpp
// processor: x64
#include <intrin.h>
#include <stdio.h>

#pragma intrinsic(_mm_cvttsd_si64x)

int main()
    __m128d d;
    __int64 b;

    double adbl[2] = { 101.5, 200.5 };

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

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

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

Community Additions

© 2015 Microsoft