FastLED 3.10.9
Loading...
Searching...
No Matches

◆ test_sra_i32_4()

bool autoresearch::simd_check::test_sra_i32_4 ( )
inline

Definition at line 452 of file AutoResearchSimd.h.

452 {
453 // Arithmetic shift preserves sign bit
454 uint32_t input[4] = {as_u32(-16), as_u32(16), 0x80000000, 0x7FFFFFFF};
455 uint32_t output[4] = {0};
456 store_u32_4(output, sra_i32_4(load_u32_4(input), 2));
457 if (as_i32(output[0]) != -4) return false; // -16 >> 2 = -4 (sign-extended)
458 if (as_i32(output[1]) != 4) return false; // 16 >> 2 = 4
459 if (as_i32(output[2]) != as_i32(0xE0000000)) return false; // 0x80000000 >> 2 sign-extended
460 if (as_i32(output[3]) != as_i32(0x1FFFFFFF)) return false; // 0x7FFFFFFF >> 2
461 return true;
462}
uint32_t as_u32(int32_t v)
int32_t as_i32(uint32_t v)

References as_i32(), and as_u32().

Referenced by getTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: