MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_add_i32_4

Function test_add_i32_4

examples/AutoResearch/AutoResearchSimd.h:405–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403// ============================================================================
404
405inline bool test_add_i32_4() {
406 // Use signed values stored as u32
407 uint32_t a[4] = {as_u32(100), as_u32(-100), as_u32(0x7FFFFFFF), as_u32(0)};
408 uint32_t b[4] = {as_u32(200), as_u32(-200), as_u32(1), as_u32(0)};
409 uint32_t output[4] = {0};
410 store_u32_4(output, add_i32_4(load_u32_4(a), load_u32_4(b)));
411 if (as_i32(output[0]) != 300) return false;
412 if (as_i32(output[1]) != -300) return false;
413 // 0x7FFFFFFF + 1 wraps (expected behavior, no saturation)
414 if (output[2] != 0x80000000) return false;
415 if (as_i32(output[3]) != 0) return false;
416 return true;
417}
418
419inline bool test_sub_i32_4() {
420 uint32_t a[4] = {as_u32(300), as_u32(-100), as_u32(0), as_u32(1000)};

Callers

nothing calls this directly

Calls 2

as_u32Function · 0.85
as_i32Function · 0.85

Tested by

no test coverage detected