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

Function VecCeil

TSSimd.h:1340–1373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1338 }
1339
1340 inline vec_float VecCeil(const vec_float& v)
1341 {
1342 #if defined(TERATHON_SSE)
1343
1344 #if defined(TERATHON_SSE4)
1345
1346 return (_mm_round_ps(v, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC));
1347
1348 #else
1349
1350 const vec_float one = VecLoadVectorConstant<0x3F800000>();
1351 const vec_float two23 = VecLoadVectorConstant<0x4B000000>();
1352
1353 vec_float result = _mm_sub_ps(_mm_add_ps(_mm_add_ps(_mm_sub_ps(v, two23), two23), two23), two23);
1354 result = _mm_add_ps(result, _mm_and_ps(one, _mm_cmplt_ps(result, v)));
1355
1356 vec_float mask = _mm_cmplt_ps(two23, _mm_andnot_ps(VecFloatGetMinusZero(), v));
1357 return (_mm_or_ps(_mm_andnot_ps(mask, result), _mm_and_ps(mask, v)));
1358
1359 #endif
1360
1361 #elif defined(TERATHON_NEON)
1362
1363 const vec_uint32 one = vdupq_n_u32(0x3F800000);
1364 const vec_float two23 = vdupq_n_f32(8388608.0F);
1365
1366 vec_float result = vsubq_f32(vaddq_f32(vaddq_f32(vsubq_f32(v, two23), two23), two23), two23);
1367 result = vaddq_f32(result, vreinterpretq_f32_u32(vandq_u32(one, vcltq_f32(result, v))));
1368
1369 vec_uint32 mask = vcltq_f32(two23, vabsq_f32(v));
1370 return (vbslq_f32(mask, v, result));
1371
1372 #endif
1373 }
1374
1375 inline vec_float VecCeilScalar(const vec_float& v)
1376 {

Callers

nothing calls this directly

Calls 1

VecFloatGetMinusZeroFunction · 0.85

Tested by

no test coverage detected