FastLED 3.9.15
Loading...
Searching...
No Matches

◆ test_sra_i32_4()

bool autoresearch::simd_check::test_sra_i32_4 ( )
inline

Definition at line 451 of file AutoResearchSimd.h.

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