* Find the highest absolute and normalized value within a float array. */
| 85 | * Find the highest absolute and normalized value within a float array. |
| 86 | */ |
| 87 | static inline |
| 88 | float d_findMaxNormalizedFloat128(const float floats[128]) |
| 89 | { |
| 90 | static constexpr const float kEmptyFloats[128] = {}; |
| 91 | |
| 92 | if (std::memcmp(floats, kEmptyFloats, sizeof(float)*128) == 0) |
| 93 | return 0.f; |
| 94 | |
| 95 | float tmp, maxf2 = std::abs(floats[0]); |
| 96 | |
| 97 | for (std::size_t i=1; i<128; ++i) |
| 98 | { |
| 99 | if (!std::isfinite(floats[i])) |
| 100 | __builtin_unreachable(); |
| 101 | |
| 102 | tmp = std::abs(floats[i]); |
| 103 | |
| 104 | if (tmp > maxf2) |
| 105 | maxf2 = tmp; |
| 106 | } |
| 107 | |
| 108 | if (maxf2 > 1.f) |
| 109 | maxf2 = 1.f; |
| 110 | |
| 111 | return maxf2; |
| 112 | } |
no test coverage detected