MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / validate_cpu_float

Function validate_cpu_float

Source/astcenc_entry.cpp:215–227  ·  view source on GitHub ↗

* @brief Validate CPU floating point meets assumptions made in the codec. * * The codec is written with the assumption that float bit patterns are valid * IEEE754 values that are stored and reloaded with round-to-nearest rounding. * This is always the case in an IEEE-754 compliant system, however not every * system or compilation mode is actually IEEE-754 compliant. This normally * fails if

Source from the content-addressed store, hash-verified

213 * @return Return @c ASTCENC_SUCCESS if validated, an error on failure.
214 */
215static astcenc_error validate_cpu_float()
216{
217 volatile float xprec_testval = 2.51f;
218 float store = xprec_testval + 12582912.0f;
219 float q = store - 12582912.0f;
220
221 if (q != 3.0f)
222 {
223 return ASTCENC_ERR_BAD_CPU_FLOAT;
224 }
225
226 return ASTCENC_SUCCESS;
227}
228
229/**
230 * @brief Validate config profile.

Callers 2

astcenc_config_initFunction · 0.85
astcenc_context_allocFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected