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

Function test_mulhi_i32_4

examples/AutoResearch/AutoResearchSimd.h:495–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493// ============================================================================
494
495inline bool test_mulhi_i32_4() {
496 // mulhi_i32_4: ((i64)a * (i64)b) >> 16
497 // Test: 0x00010000 * 0x00020000 >> 16 = 0x00020000 (1.0 * 2.0 = 2.0 in Q16.16)
498 uint32_t a[4] = {0x00010000, 0x00020000, as_u32(-0x00010000), 0x00008000};
499 uint32_t b[4] = {0x00020000, 0x00010000, 0x00020000, 0x00008000};
500 uint32_t output[4] = {0};
501 store_u32_4(output, mulhi_i32_4(load_u32_4(a), load_u32_4(b)));
502 if (output[0] != 0x00020000) return false; // 1.0 * 2.0 = 2.0
503 if (output[1] != 0x00020000) return false; // 2.0 * 1.0 = 2.0
504 if (as_i32(output[2]) != -0x00020000) return false; // -1.0 * 2.0 = -2.0
505 if (output[3] != 0x00004000) return false; // 0.5 * 0.5 = 0.25
506 return true;
507}
508
509inline bool test_mulhi_u32_4() {
510 // mulhi_u32_4: ((u64)a * (u64)b) >> 16 (unsigned)

Callers

nothing calls this directly

Calls 2

as_u32Function · 0.85
as_i32Function · 0.85

Tested by

no test coverage detected