共用方式為


_mm_floor_ss

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction roundss. This instruction rounds a parameter down. The rounded value replaces the lower 64 bits of the other parameter.

__m128 _mm_floor_ss( 
   __m128 a,
   __m128 b
);

Parameters

  • [in] a
    A 128-bit parameter that contains four 32-bit floating point values.

  • [in] b
    A 128-bit parameter that contains a floating point value in the lowest 32 bits.

Return value

The result can be expressed with the following equations:

r0 := FLOOR(b0)
r1 := a1
r2 := a2
r3 := a3

Requirements

Intrinsic

Architecture

_mm_floor_ss

x86, x64

Header file <smmintrin.h>

Remarks

r0-r3, a0-a3, and b0-b3 are the sequentially ordered 32-bit components of return value r and parameters a and b. r0, a0, and b0 denote the least significant 32 bits.

This function is implemented as a macro that invokes intrinsic _mm_round_ss.

Before you use this intrinsic, software must ensure that the processor supports the instruction.

Example

#include <stdio.h>
#include <smmintrin.h>

int main ()
{
    __m128 a, b;

    a.m128_f32[0] = 0.0;
    a.m128_f32[1] = 3.5;
    a.m128_f32[2] = 500;
    a.m128_f32[3] = 25.25;
    b.m128_f32[0] = -1.625;
    b.m128_f32[1] = 0.0;
    b.m128_f32[2] = 0.0;
    b.m128_f32[3] = 0.0;

    __m128 res = _mm_floor_ss(a, b);
    
    printf_s("Original a: %f\t%f\t%f\t%f\nOriginal b: %f\t%f\t%f\t%f\n",
                a.m128_f32[0], a.m128_f32[1], a.m128_f32[2], a.m128_f32[3],
                b.m128_f32[0], b.m128_f32[1], b.m128_f32[2], b.m128_f32[3]);
    printf_s("Result res: %f\t%f\t%f\t%f\n",
                res.m128_f32[0], res.m128_f32[1], res.m128_f32[2], res.m128_f32[3]);

    return 0;
}

Original a: 0.000000    3.500000        500.000000      25.250000
Original b: -1.625000   0.000000        0.000000        0.000000
Result res: -2.000000   3.500000        500.000000      25.250000

See Also

Concepts

Compiler Intrinsics