MCPcopy Create free account
hub / github.com/ValveSoftware/steam-audio / addConstant

Method addConstant

core/src/core/array_math.cpp:366–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366void ArrayMath::addConstant(int size,
367 const float* in,
368 float constant,
369 float* out)
370{
371 auto simdSize = size & ~3;
372 auto simdConstant = float4::set1(constant);
373
374 if (float4::isAligned(in) && float4::isAligned(out))
375 {
376 for (auto i = 0; i < simdSize; i += 4)
377 {
378 float4::store(&out[i], float4::add(float4::load(&in[i]), simdConstant));
379 }
380 }
381 else
382 {
383 for (auto i = 0; i < simdSize; i += 4)
384 {
385 float4::storeu(&out[i], float4::add(float4::loadu(&in[i]), simdConstant));
386 }
387 }
388
389 for (auto i = simdSize; i < size; ++i)
390 {
391 out[i] = in[i] + constant;
392 }
393}
394
395void ArrayMath::max(int size,
396 const float* in,

Callers

nothing calls this directly

Calls 7

set1Function · 0.70
isAlignedFunction · 0.70
storeFunction · 0.70
addFunction · 0.70
loadFunction · 0.70
storeuFunction · 0.70
loaduFunction · 0.70

Tested by

no test coverage detected