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

Function VecNegativeFloor

TSSimd.h:1282–1309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1280 }
1281
1282 inline vec_float VecNegativeFloor(const vec_float& v)
1283 {
1284 #if defined(TERATHON_SSE)
1285
1286 #if defined(TERATHON_SSE4)
1287
1288 return (_mm_round_ps(v, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC));
1289
1290 #else
1291
1292 const vec_float one = VecLoadVectorConstant<0x3F800000>();
1293 const vec_float two23 = VecLoadVectorConstant<0x4B000000>();
1294
1295 vec_float result = _mm_add_ps(_mm_sub_ps(v, two23), two23);
1296 return (_mm_sub_ps(result, _mm_and_ps(one, _mm_cmplt_ps(v, result))));
1297
1298 #endif
1299
1300 #elif defined(TERATHON_NEON)
1301
1302 const vec_uint32 one = vdupq_n_u32(0x3F800000);
1303 const vec_float two23 = vdupq_n_f32(8388608.0F);
1304
1305 vec_float result = vaddq_f32(vsubq_f32(v, two23), two23);
1306 return (vsubq_f32(result, vreinterpretq_f32_u32(vandq_u32(one, vcltq_f32(v, result)))));
1307
1308 #endif
1309 }
1310
1311 inline vec_float VecNegativeFloorScalar(const vec_float& v)
1312 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected