This documentation is archived and is not being maintained.


Microsoft Specific

Applies a type cast to reinterpret two 64-bit floating point values passed in as a 128-bit parameter as packed 32-bit integers.

__m128i _mm_castpd_si128( 
   __m128d a

[in] a

A 128-bit parameter that contains two 64-bit floating point values.




x86, x64

Header file <emmintrin.h>

The 128-bit return value r is a copy of the 128-bit parameter a, but cast as four 32-bit integers. This intrinsic changes one data type to another without performing any conversion.

This intrinsic does not map to any specific machine instruction.

// _mm_castpd_si128.cpp
#include <stdio.h>
#include <emmintrin.h>

int main () {
    __m128d a;

    a.m128d_f64[1] = 0.00125;
    a.m128d_f64[0] = 2;

    __m128i res = _mm_castpd_si128( a );

    printf_s("Original a: %10f %10f\n",
                a.m128d_f64[1], a.m128d_f64[0]);

    printf_s("Result res: %10i %10i %10i %10i\n",
                res.m128i_i32[3], res.m128i_i32[2],
                res.m128i_i32[1], res.m128i_i32[0]);

    __m128d newA = _mm_castsi128_pd( res );

    printf_s("New a:      %10f %10f\n",
                newA.m128d_f64[1], newA.m128d_f64[0]);

    return 0;
Original a:   0.001250   2.000000
Result res: 1062501089 1202590843 1073741824          0
New a:        0.001250   2.000000