File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,7 @@ static inline int RoundInt(float const x)
75
75
#if 0 //_M_IX86_FP > 0
76
76
return int(roundf(x));
77
77
#elif _M_IX86_FP > 0
78
- register __m128 xx = _mm_load_ss(&x);
79
- return _mm_cvtss_si32(_mm_add_ss(_mm_add_ss(xx, xx), _mm_set_ss(0.5f))) >> 1;
78
+ return _mm_cvt_ss2si(_mm_set_ss(x + x + 0.5f)) >> 1;
80
79
#else
81
80
float const round_nearest = 0 .5f ;
82
81
int i;
@@ -98,8 +97,7 @@ static inline int FloorInt(float const x)
98
97
#if 0 //_M_IX86_FP > 0
99
98
return int(floorf(x));
100
99
#elif _M_IX86_FP > 0
101
- register __m128 xx = _mm_load_ss(&x);
102
- return _mm_cvtss_si32(_mm_add_ss(_mm_add_ss(xx, xx), _mm_set_ss(-0.5f))) >> 1;
100
+ return _mm_cvt_ss2si(_mm_set_ss(x + x - 0.5f)) >> 1;
103
101
#else
104
102
float const round_minus_infinity = -0 .5f ;
105
103
int i;
@@ -121,8 +119,7 @@ static inline int CeilingInt(float const x)
121
119
#if 0 //_M_IX86_FP > 0
122
120
return int(ceilf(x));
123
121
#elif _M_IX86_FP > 0
124
- register __m128 xx = _mm_load_ss(&x);
125
- return -(_mm_cvtss_si32(_mm_sub_ss(_mm_set_ss(-0.5f), _mm_add_ss(xx, xx))) >> 1);
122
+ return -(_mm_cvt_ss2si(_mm_set_ss(-0.5f - (x + x))) >> 1);
126
123
#else
127
124
float const round_plus_infinity = -0 .5f ;
128
125
int i;
@@ -142,7 +139,7 @@ static inline int CeilingInt(float const x)
142
139
static inline int TruncateInt (float const x)
143
140
{
144
141
#if _M_IX86_FP > 0
145
- return int (x );
142
+ return _mm_cvtt_ss2si ( _mm_set_ss (x) );
146
143
#else
147
144
float const round_minus_infinity = -0 .5f ;
148
145
int i;
You can’t perform that action at this time.
0 commit comments