MCPcopy Create free account
hub / github.com/EricLengyel/Terathon-Math-Library / VecPositiveFloor

Function VecPositiveFloor

TSSimd.h:1224–1251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1222 }
1223
1224 inline vec_float VecPositiveFloor(const vec_float& v)
1225 {
1226 #if defined(TERATHON_SSE)
1227
1228 #if defined(TERATHON_SSE4)
1229
1230 return (_mm_round_ps(v, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC));
1231
1232 #else
1233
1234 const vec_float one = VecLoadVectorConstant<0x3F800000>();
1235 const vec_float two23 = VecLoadVectorConstant<0x4B000000>();
1236
1237 vec_float result = _mm_sub_ps(_mm_add_ps(v, two23), two23);
1238 return (_mm_sub_ps(result, _mm_and_ps(one, _mm_cmplt_ps(v, result))));
1239
1240 #endif
1241
1242 #elif defined(TERATHON_NEON)
1243
1244 const vec_uint32 one = vdupq_n_u32(0x3F800000);
1245 const vec_float two23 = vdupq_n_f32(8388608.0F);
1246
1247 vec_float result = vsubq_f32(vaddq_f32(v, two23), two23);
1248 return (vsubq_f32(result, vreinterpretq_f32_u32(vandq_u32(one, vcltq_f32(v, result)))));
1249
1250 #endif
1251 }
1252
1253 inline vec_float VecPositiveFloorScalar(const vec_float& v)
1254 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected