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

Function test_add_sat_u8_16

examples/SIMD/simd_tests.cpp:61–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59// ============================================================================
60
61void test_add_sat_u8_16(TestResult& result) {
62 uint8_t a_data[16] = {100, 150, 200, 250, 100, 150, 200, 250, 100, 150, 200, 250, 100, 150, 200, 250};
63 uint8_t b_data[16] = {50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100};
64 uint8_t expected[16] = {150, 250, 250, 255, 150, 250, 250, 255, 150, 250, 250, 255, 150, 250, 250, 255};
65 uint8_t output[16] = {0};
66
67 simd_u8x16 a = load_u8_16(a_data);
68 simd_u8x16 b = load_u8_16(b_data);
69 simd_u8x16 c = add_sat_u8_16(a, b);
70 store_u8_16(output, c);
71
72 if (!compare_u8_arrays(expected, output, 16)) {
73 result.fail("Saturating add produced incorrect results");
74 }
75}
76
77void test_sub_sat_u8_16(TestResult& result) {
78 uint8_t a_data[16] = {100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10};

Callers

nothing calls this directly

Calls 2

compare_u8_arraysFunction · 0.85
failMethod · 0.45

Tested by

no test coverage detected