From: Leon Romanovsky <leonro@xxxxxxxxxxxx> Expand existing check_*_overflow tests to support check_shift_overflow(). Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> --- lib/test_overflow.c | 351 ++++++++++++++++++++++++++-------------------------- 1 file changed, 177 insertions(+), 174 deletions(-) diff --git a/lib/test_overflow.c b/lib/test_overflow.c index 2278fe05a1b0..df98f81d7a1f 100644 --- a/lib/test_overflow.c +++ b/lib/test_overflow.c @@ -17,202 +17,204 @@ #define DEFINE_TEST_ARRAY(t) \ static const struct test_ ## t { \ t a, b; \ - t sum, diff, prod; \ - bool s_of, d_of, p_of; \ + t sum, diff, prod, shift; \ + bool s_of, d_of, p_of, sh_of; \ } t ## _tests[] __initconst DEFINE_TEST_ARRAY(u8) = { - {0, 0, 0, 0, 0, false, false, false}, - {1, 1, 2, 0, 1, false, false, false}, - {0, 1, 1, U8_MAX, 0, false, true, false}, - {1, 0, 1, 1, 0, false, false, false}, - {0, U8_MAX, U8_MAX, 1, 0, false, true, false}, - {U8_MAX, 0, U8_MAX, U8_MAX, 0, false, false, false}, - {1, U8_MAX, 0, 2, U8_MAX, true, true, false}, - {U8_MAX, 1, 0, U8_MAX-1, U8_MAX, true, false, false}, - {U8_MAX, U8_MAX, U8_MAX-1, 0, 1, true, false, true}, - - {U8_MAX, U8_MAX-1, U8_MAX-2, 1, 2, true, false, true}, - {U8_MAX-1, U8_MAX, U8_MAX-2, U8_MAX, 2, true, true, true}, - - {1U << 3, 1U << 3, 1U << 4, 0, 1U << 6, false, false, false}, - {1U << 4, 1U << 4, 1U << 5, 0, 0, false, false, true}, - {1U << 4, 1U << 3, 3*(1U << 3), 1U << 3, 1U << 7, false, false, false}, - {1U << 7, 1U << 7, 0, 0, 0, true, false, true}, - - {48, 32, 80, 16, 0, false, false, true}, - {128, 128, 0, 0, 0, true, false, true}, - {123, 234, 101, 145, 110, true, true, true}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + {1, 1, 2, 0, 1, 2, false, false, false, false}, + {0, 1, 1, U8_MAX, 0, 0, false, true, false, false}, + {1, 0, 1, 1, 0, 1, false, false, false, false}, + {0, U8_MAX, U8_MAX, 1, 0, 0, false, true, false, true}, + {U8_MAX, 0, U8_MAX, U8_MAX, 0, U8_MAX, false, false, false, false}, + {1, U8_MAX, 0, 2, U8_MAX, 1, true, true, false, true}, + {U8_MAX, 1, 0, U8_MAX-1, U8_MAX, U8_MAX-1, true, false, false, true}, + {U8_MAX, U8_MAX, U8_MAX-1, 0, 1, U8_MAX, true, false, true, true}, + + {U8_MAX, U8_MAX-1, U8_MAX-2, 1, 2, U8_MAX, true, false, true, true}, + {U8_MAX-1, U8_MAX, U8_MAX-2, U8_MAX, 2, U8_MAX-1, true, true, true, true}, + + {1U << 1, 1U << 1, 1U << 2, 0, 1U << 2, 1U << 3, false, false, false, false}, + {1U << 2, 1U << 2, 1U << 3, 0, 1U << 4, 1U << 6, false, false, false, false}, + {1U << 3, 1U << 3, 1U << 4, 0, 1U << 6, 1U << 3, false, false, false, true}, + {1U << 4, 1U << 4, 1U << 5, 0, 0, 1U << 4, false, false, true, true}, + {1U << 4, 1U << 3, 3*(1U << 3), 1U << 3, 1U << 7, 1U << 4, false, false, false, true}, + {1U << 7, 1U << 7, 0, 0, 0, 1U << 7, true, false, true, true}, + + {48, 32, 80, 16, 0, 48, false, false, true, true}, + {128, 128, 0, 0, 0, 128, true, false, true, true}, + {123, 234, 101, 145, 110, 123, true, true, true, true}, }; DEFINE_TEST_ARRAY(u16) = { - {0, 0, 0, 0, 0, false, false, false}, - {1, 1, 2, 0, 1, false, false, false}, - {0, 1, 1, U16_MAX, 0, false, true, false}, - {1, 0, 1, 1, 0, false, false, false}, - {0, U16_MAX, U16_MAX, 1, 0, false, true, false}, - {U16_MAX, 0, U16_MAX, U16_MAX, 0, false, false, false}, - {1, U16_MAX, 0, 2, U16_MAX, true, true, false}, - {U16_MAX, 1, 0, U16_MAX-1, U16_MAX, true, false, false}, - {U16_MAX, U16_MAX, U16_MAX-1, 0, 1, true, false, true}, - - {U16_MAX, U16_MAX-1, U16_MAX-2, 1, 2, true, false, true}, - {U16_MAX-1, U16_MAX, U16_MAX-2, U16_MAX, 2, true, true, true}, - - {1U << 7, 1U << 7, 1U << 8, 0, 1U << 14, false, false, false}, - {1U << 8, 1U << 8, 1U << 9, 0, 0, false, false, true}, - {1U << 8, 1U << 7, 3*(1U << 7), 1U << 7, 1U << 15, false, false, false}, - {1U << 15, 1U << 15, 0, 0, 0, true, false, true}, - - {123, 234, 357, 65425, 28782, false, true, false}, - {1234, 2345, 3579, 64425, 10146, false, true, true}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + {1, 1, 2, 0, 1, 2, false, false, false, false}, + {0, 1, 1, U16_MAX, 0, 0, false, true, false, false}, + {1, 0, 1, 1, 0, 1, false, false, false, false}, + {0, U16_MAX, U16_MAX, 1, 0, 0, false, true, false, true}, + {U16_MAX, 0, U16_MAX, U16_MAX, 0, U16_MAX, false, false, false, false}, + {1, U16_MAX, 0, 2, U16_MAX, 1, true, true, false, true}, + {U16_MAX, 1, 0, U16_MAX-1, U16_MAX, U16_MAX-1, true, false, false, true}, + {U16_MAX, U16_MAX, U16_MAX-1, 0, 1, U16_MAX, true, false, true, true}, + + {U16_MAX, U16_MAX-1, U16_MAX-2, 1, 2, U16_MAX, true, false, true, true}, + {U16_MAX-1, U16_MAX, U16_MAX-2, U16_MAX, 2, U16_MAX-1, true, true, true, true}, + + {1U << 7, 1U << 7, 1U << 8, 0, 1U << 14, 1U << 7, false, false, false, true}, + {1U << 8, 1U << 8, 1U << 9, 0, 0, 1U << 8, false, false, true, true}, + {1U << 8, 1U << 7, 3*(1U << 7), 1U << 7, 1U << 15, 1U << 8, false, false, false, true}, + {1U << 15, 1U << 15, 0, 0, 0, 1U << 15, true, false, true, true}, + + {123, 234, 357, 65425, 28782, 123, false, true, false, true}, + {1234, 2345, 3579, 64425, 10146, 1234, false, true, true, true}, }; DEFINE_TEST_ARRAY(u32) = { - {0, 0, 0, 0, 0, false, false, false}, - {1, 1, 2, 0, 1, false, false, false}, - {0, 1, 1, U32_MAX, 0, false, true, false}, - {1, 0, 1, 1, 0, false, false, false}, - {0, U32_MAX, U32_MAX, 1, 0, false, true, false}, - {U32_MAX, 0, U32_MAX, U32_MAX, 0, false, false, false}, - {1, U32_MAX, 0, 2, U32_MAX, true, true, false}, - {U32_MAX, 1, 0, U32_MAX-1, U32_MAX, true, false, false}, - {U32_MAX, U32_MAX, U32_MAX-1, 0, 1, true, false, true}, - - {U32_MAX, U32_MAX-1, U32_MAX-2, 1, 2, true, false, true}, - {U32_MAX-1, U32_MAX, U32_MAX-2, U32_MAX, 2, true, true, true}, - - {1U << 15, 1U << 15, 1U << 16, 0, 1U << 30, false, false, false}, - {1U << 16, 1U << 16, 1U << 17, 0, 0, false, false, true}, - {1U << 16, 1U << 15, 3*(1U << 15), 1U << 15, 1U << 31, false, false, false}, - {1U << 31, 1U << 31, 0, 0, 0, true, false, true}, - - {-2U, 1U, -1U, -3U, -2U, false, false, false}, - {-4U, 5U, 1U, -9U, -20U, true, false, true}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + {1, 1, 2, 0, 1, 2, false, false, false, false}, + {0, 1, 1, U32_MAX, 0, 0, false, true, false, false}, + {1, 0, 1, 1, 0, 1, false, false, false, false}, + {0, U32_MAX, U32_MAX, 1, 0, 0, false, true, false, true}, + {U32_MAX, 0, U32_MAX, U32_MAX, 0, U32_MAX, false, false, false, false}, + {1, U32_MAX, 0, 2, U32_MAX, 1, true, true, false, true}, + {U32_MAX, 1, 0, U32_MAX-1, U32_MAX, U32_MAX-1, true, false, false, true}, + {U32_MAX, U32_MAX, U32_MAX-1, 0, 1, U32_MAX, true, false, true, true}, + + {U32_MAX, U32_MAX-1, U32_MAX-2, 1, 2, U32_MAX, true, false, true, true}, + {U32_MAX-1, U32_MAX, U32_MAX-2, U32_MAX, 2, U32_MAX-1, true, true, true, true}, + + {1U << 15, 1U << 15, 1U << 16, 0, 1U << 30, 1U << 15, false, false, false, true}, + {1U << 16, 1U << 16, 1U << 17, 0, 0, 1U << 16, false, false, true, true}, + {1U << 16, 1U << 15, 3*(1U << 15), 1U << 15, 1U << 31, 1U << 16, false, false, false, true}, + {1U << 31, 1U << 31, 0, 0, 0, 1U << 31, true, false, true, true}, + + {-2U, 1U, -1U, -3U, -2U, -4U, false, false, false, true}, + {-4U, 5U, 1U, -9U, -20U, -128U, true, false, true, true}, }; DEFINE_TEST_ARRAY(u64) = { - {0, 0, 0, 0, 0, false, false, false}, - {1, 1, 2, 0, 1, false, false, false}, - {0, 1, 1, U64_MAX, 0, false, true, false}, - {1, 0, 1, 1, 0, false, false, false}, - {0, U64_MAX, U64_MAX, 1, 0, false, true, false}, - {U64_MAX, 0, U64_MAX, U64_MAX, 0, false, false, false}, - {1, U64_MAX, 0, 2, U64_MAX, true, true, false}, - {U64_MAX, 1, 0, U64_MAX-1, U64_MAX, true, false, false}, - {U64_MAX, U64_MAX, U64_MAX-1, 0, 1, true, false, true}, - - {U64_MAX, U64_MAX-1, U64_MAX-2, 1, 2, true, false, true}, - {U64_MAX-1, U64_MAX, U64_MAX-2, U64_MAX, 2, true, true, true}, - - {1ULL << 31, 1ULL << 31, 1ULL << 32, 0, 1ULL << 62, false, false, false}, - {1ULL << 32, 1ULL << 32, 1ULL << 33, 0, 0, false, false, true}, - {1ULL << 32, 1ULL << 31, 3*(1ULL << 31), 1ULL << 31, 1ULL << 63, false, false, false}, - {1ULL << 63, 1ULL << 63, 0, 0, 0, true, false, true}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + {1, 1, 2, 0, 1, 2, false, false, false, false}, + {0, 1, 1, U64_MAX, 0, 0, false, true, false, false}, + {1, 0, 1, 1, 0, 1, false, false, false, false}, + {0, U64_MAX, U64_MAX, 1, 0, 0, false, true, false, true}, + {U64_MAX, 0, U64_MAX, U64_MAX, 0, U64_MAX, false, false, false, false}, + {1, U64_MAX, 0, 2, U64_MAX, 1, true, true, false, true}, + {U64_MAX, 1, 0, U64_MAX-1, U64_MAX, U64_MAX-1, true, false, false, true}, + {U64_MAX, U64_MAX, U64_MAX-1, 0, 1, U64_MAX, true, false, true, true}, + + {U64_MAX, U64_MAX-1, U64_MAX-2, 1, 2, U64_MAX, true, false, true, true}, + {U64_MAX-1, U64_MAX, U64_MAX-2, U64_MAX, 2, U64_MAX-1, true, true, true, true}, + + {1ULL << 31, 1ULL << 31, 1ULL << 32, 0, 1ULL << 62, 1ULL << 31, false, false, false, true}, + {1ULL << 32, 1ULL << 32, 1ULL << 33, 0, 0, 1ULL << 32, false, false, true, true}, + {1ULL << 32, 1ULL << 31, 3*(1ULL << 31), 1ULL << 31, 1ULL << 63, 1ULL << 32, false, false, false, true}, + {1ULL << 63, 1ULL << 63, 0, 0, 0, 1ULL << 63, true, false, true, true}, {1000000000ULL /* 10^9 */, 10000000000ULL /* 10^10 */, 11000000000ULL, 18446744064709551616ULL, 10000000000000000000ULL, - false, true, false}, - {-15ULL, 10ULL, -5ULL, -25ULL, -150ULL, false, false, true}, + 1000000000ULL, false, true, false, true}, + {-15ULL, 10ULL, -5ULL, -25ULL, -150ULL, -15360ULL, false, false, true, true}, }; DEFINE_TEST_ARRAY(s8) = { - {0, 0, 0, 0, 0, false, false, false}, - - {0, S8_MAX, S8_MAX, -S8_MAX, 0, false, false, false}, - {S8_MAX, 0, S8_MAX, S8_MAX, 0, false, false, false}, - {0, S8_MIN, S8_MIN, S8_MIN, 0, false, true, false}, - {S8_MIN, 0, S8_MIN, S8_MIN, 0, false, false, false}, - - {-1, S8_MIN, S8_MAX, S8_MAX, S8_MIN, true, false, true}, - {S8_MIN, -1, S8_MAX, -S8_MAX, S8_MIN, true, false, true}, - {-1, S8_MAX, S8_MAX-1, S8_MIN, -S8_MAX, false, false, false}, - {S8_MAX, -1, S8_MAX-1, S8_MIN, -S8_MAX, false, true, false}, - {-1, -S8_MAX, S8_MIN, S8_MAX-1, S8_MAX, false, false, false}, - {-S8_MAX, -1, S8_MIN, S8_MIN+2, S8_MAX, false, false, false}, - - {1, S8_MIN, -S8_MAX, -S8_MAX, S8_MIN, false, true, false}, - {S8_MIN, 1, -S8_MAX, S8_MAX, S8_MIN, false, true, false}, - {1, S8_MAX, S8_MIN, S8_MIN+2, S8_MAX, true, false, false}, - {S8_MAX, 1, S8_MIN, S8_MAX-1, S8_MAX, true, false, false}, - - {S8_MIN, S8_MIN, 0, 0, 0, true, false, true}, - {S8_MAX, S8_MAX, -2, 0, 1, true, false, true}, - - {-4, -32, -36, 28, -128, false, false, true}, - {-4, 32, 28, -36, -128, false, false, false}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + + {0, S8_MAX, S8_MAX, -S8_MAX, 0, 0, false, false, false, true}, + {S8_MAX, 0, S8_MAX, S8_MAX, 0, S8_MAX, false, false, false, false}, + {0, S8_MIN, S8_MIN, S8_MIN, 0, 0, false, true, false, true}, + {S8_MIN, 0, S8_MIN, S8_MIN, 0, S8_MIN, false, false, false, true}, + + {-1, S8_MIN, S8_MAX, S8_MAX, S8_MIN, -1, true, false, true, true}, + {S8_MIN, -1, S8_MAX, -S8_MAX, S8_MIN, S8_MIN, true, false, true, true}, + {-1, S8_MAX, S8_MAX-1, S8_MIN, -S8_MAX, -1, false, false, false, true}, + {S8_MAX, -1, S8_MAX-1, S8_MIN, -S8_MAX, S8_MAX, false, true, false, true}, + {-1, -S8_MAX, S8_MIN, S8_MAX-1, S8_MAX, -1, false, false, false, true}, + {-S8_MAX, -1, S8_MIN, S8_MIN+2, S8_MAX, -S8_MAX, false, false, false, true}, + + {1, S8_MIN, -S8_MAX, -S8_MAX, S8_MIN, 1, false, true, false, true}, + {S8_MIN, 1, -S8_MAX, S8_MAX, S8_MIN, 0, false, true, false, true}, + {1, S8_MAX, S8_MIN, S8_MIN+2, S8_MAX, 1, true, false, false, true}, + {S8_MAX, 1, S8_MIN, S8_MAX-1, S8_MAX, -2, true, false, false, true}, + + {S8_MIN, S8_MIN, 0, 0, 0, S8_MIN, true, false, true, true}, + {S8_MAX, S8_MAX, -2, 0, 1, S8_MAX, true, false, true, true}, + + {-4, -32, -36, 28, -128, -4, false, false, true, true}, + {-4, 32, 28, -36, -128, -4, false, false, false, true}, }; DEFINE_TEST_ARRAY(s16) = { - {0, 0, 0, 0, 0, false, false, false}, - - {0, S16_MAX, S16_MAX, -S16_MAX, 0, false, false, false}, - {S16_MAX, 0, S16_MAX, S16_MAX, 0, false, false, false}, - {0, S16_MIN, S16_MIN, S16_MIN, 0, false, true, false}, - {S16_MIN, 0, S16_MIN, S16_MIN, 0, false, false, false}, - - {-1, S16_MIN, S16_MAX, S16_MAX, S16_MIN, true, false, true}, - {S16_MIN, -1, S16_MAX, -S16_MAX, S16_MIN, true, false, true}, - {-1, S16_MAX, S16_MAX-1, S16_MIN, -S16_MAX, false, false, false}, - {S16_MAX, -1, S16_MAX-1, S16_MIN, -S16_MAX, false, true, false}, - {-1, -S16_MAX, S16_MIN, S16_MAX-1, S16_MAX, false, false, false}, - {-S16_MAX, -1, S16_MIN, S16_MIN+2, S16_MAX, false, false, false}, - - {1, S16_MIN, -S16_MAX, -S16_MAX, S16_MIN, false, true, false}, - {S16_MIN, 1, -S16_MAX, S16_MAX, S16_MIN, false, true, false}, - {1, S16_MAX, S16_MIN, S16_MIN+2, S16_MAX, true, false, false}, - {S16_MAX, 1, S16_MIN, S16_MAX-1, S16_MAX, true, false, false}, - - {S16_MIN, S16_MIN, 0, 0, 0, true, false, true}, - {S16_MAX, S16_MAX, -2, 0, 1, true, false, true}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + + {0, S16_MAX, S16_MAX, -S16_MAX, 0, 0, false, false, false, true}, + {S16_MAX, 0, S16_MAX, S16_MAX, 0, S16_MAX, false, false, false, false}, + {0, S16_MIN, S16_MIN, S16_MIN, 0, 0, false, true, false, true}, + {S16_MIN, 0, S16_MIN, S16_MIN, 0, S16_MIN, false, false, false, true}, + + {-1, S16_MIN, S16_MAX, S16_MAX, S16_MIN, -1, true, false, true, true}, + {S16_MIN, -1, S16_MAX, -S16_MAX, S16_MIN, S16_MIN, true, false, true, true}, + {-1, S16_MAX, S16_MAX-1, S16_MIN, -S16_MAX, -1, false, false, false, true}, + {S16_MAX, -1, S16_MAX-1, S16_MIN, -S16_MAX, S16_MAX, false, true, false, true}, + {-1, -S16_MAX, S16_MIN, S16_MAX-1, S16_MAX, -1, false, false, false, true}, + {-S16_MAX, -1, S16_MIN, S16_MIN+2, S16_MAX, -S16_MAX, false, false, false, true}, + + {1, S16_MIN, -S16_MAX, -S16_MAX, S16_MIN, 1, false, true, false, true}, + {S16_MIN, 1, -S16_MAX, S16_MAX, S16_MIN, 0, false, true, false, true}, + {1, S16_MAX, S16_MIN, S16_MIN+2, S16_MAX, 1, true, false, false, true}, + {S16_MAX, 1, S16_MIN, S16_MAX-1, S16_MAX, -2, true, false, false, true}, + + {S16_MIN, S16_MIN, 0, 0, 0, S16_MIN, true, false, true, true}, + {S16_MAX, S16_MAX, -2, 0, 1, S16_MAX, true, false, true, true}, }; DEFINE_TEST_ARRAY(s32) = { - {0, 0, 0, 0, 0, false, false, false}, - - {0, S32_MAX, S32_MAX, -S32_MAX, 0, false, false, false}, - {S32_MAX, 0, S32_MAX, S32_MAX, 0, false, false, false}, - {0, S32_MIN, S32_MIN, S32_MIN, 0, false, true, false}, - {S32_MIN, 0, S32_MIN, S32_MIN, 0, false, false, false}, - - {-1, S32_MIN, S32_MAX, S32_MAX, S32_MIN, true, false, true}, - {S32_MIN, -1, S32_MAX, -S32_MAX, S32_MIN, true, false, true}, - {-1, S32_MAX, S32_MAX-1, S32_MIN, -S32_MAX, false, false, false}, - {S32_MAX, -1, S32_MAX-1, S32_MIN, -S32_MAX, false, true, false}, - {-1, -S32_MAX, S32_MIN, S32_MAX-1, S32_MAX, false, false, false}, - {-S32_MAX, -1, S32_MIN, S32_MIN+2, S32_MAX, false, false, false}, - - {1, S32_MIN, -S32_MAX, -S32_MAX, S32_MIN, false, true, false}, - {S32_MIN, 1, -S32_MAX, S32_MAX, S32_MIN, false, true, false}, - {1, S32_MAX, S32_MIN, S32_MIN+2, S32_MAX, true, false, false}, - {S32_MAX, 1, S32_MIN, S32_MAX-1, S32_MAX, true, false, false}, - - {S32_MIN, S32_MIN, 0, 0, 0, true, false, true}, - {S32_MAX, S32_MAX, -2, 0, 1, true, false, true}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + + {0, S32_MAX, S32_MAX, -S32_MAX, 0, 0, false, false, false, true}, + {S32_MAX, 0, S32_MAX, S32_MAX, 0, S32_MAX, false, false, false, false}, + {0, S32_MIN, S32_MIN, S32_MIN, 0, 0, false, true, false, true}, + {S32_MIN, 0, S32_MIN, S32_MIN, 0, S32_MIN, false, false, false, true}, + + {-1, S32_MIN, S32_MAX, S32_MAX, S32_MIN, -1, true, false, true, true}, + {S32_MIN, -1, S32_MAX, -S32_MAX, S32_MIN, S32_MIN, true, false, true, true}, + {-1, S32_MAX, S32_MAX-1, S32_MIN, -S32_MAX, -1, false, false, false, true}, + {S32_MAX, -1, S32_MAX-1, S32_MIN, -S32_MAX, S32_MAX, false, true, false, true}, + {-1, -S32_MAX, S32_MIN, S32_MAX-1, S32_MAX, -1, false, false, false, true}, + {-S32_MAX, -1, S32_MIN, S32_MIN+2, S32_MAX, -S32_MAX, false, false, false, true}, + + {1, S32_MIN, -S32_MAX, -S32_MAX, S32_MIN, 1, false, true, false, true}, + {S32_MIN, 1, -S32_MAX, S32_MAX, S32_MIN, 0, false, true, false, true}, + {1, S32_MAX, S32_MIN, S32_MIN+2, S32_MAX, 1, true, false, false, true}, + {S32_MAX, 1, S32_MIN, S32_MAX-1, S32_MAX, -2, true, false, false, true}, + + {S32_MIN, S32_MIN, 0, 0, 0, S32_MIN, true, false, true, true}, + {S32_MAX, S32_MAX, -2, 0, 1, S32_MAX, true, false, true, true}, }; DEFINE_TEST_ARRAY(s64) = { - {0, 0, 0, 0, 0, false, false, false}, - - {0, S64_MAX, S64_MAX, -S64_MAX, 0, false, false, false}, - {S64_MAX, 0, S64_MAX, S64_MAX, 0, false, false, false}, - {0, S64_MIN, S64_MIN, S64_MIN, 0, false, true, false}, - {S64_MIN, 0, S64_MIN, S64_MIN, 0, false, false, false}, - - {-1, S64_MIN, S64_MAX, S64_MAX, S64_MIN, true, false, true}, - {S64_MIN, -1, S64_MAX, -S64_MAX, S64_MIN, true, false, true}, - {-1, S64_MAX, S64_MAX-1, S64_MIN, -S64_MAX, false, false, false}, - {S64_MAX, -1, S64_MAX-1, S64_MIN, -S64_MAX, false, true, false}, - {-1, -S64_MAX, S64_MIN, S64_MAX-1, S64_MAX, false, false, false}, - {-S64_MAX, -1, S64_MIN, S64_MIN+2, S64_MAX, false, false, false}, - - {1, S64_MIN, -S64_MAX, -S64_MAX, S64_MIN, false, true, false}, - {S64_MIN, 1, -S64_MAX, S64_MAX, S64_MIN, false, true, false}, - {1, S64_MAX, S64_MIN, S64_MIN+2, S64_MAX, true, false, false}, - {S64_MAX, 1, S64_MIN, S64_MAX-1, S64_MAX, true, false, false}, - - {S64_MIN, S64_MIN, 0, 0, 0, true, false, true}, - {S64_MAX, S64_MAX, -2, 0, 1, true, false, true}, - - {-1, -1, -2, 0, 1, false, false, false}, - {-1, -128, -129, 127, 128, false, false, false}, - {-128, -1, -129, -127, 128, false, false, false}, - {0, -S64_MAX, -S64_MAX, S64_MAX, 0, false, false, false}, + {0, 0, 0, 0, 0, 0, false, false, false, false}, + + {0, S64_MAX, S64_MAX, -S64_MAX, 0, 0, false, false, false, true}, + {S64_MAX, 0, S64_MAX, S64_MAX, 0, S64_MAX, false, false, false, false}, + {0, S64_MIN, S64_MIN, S64_MIN, 0, 0, false, true, false, true}, + {S64_MIN, 0, S64_MIN, S64_MIN, 0, S64_MIN, false, false, false, true}, + + {-1, S64_MIN, S64_MAX, S64_MAX, S64_MIN, -1, true, false, true, true}, + {S64_MIN, -1, S64_MAX, -S64_MAX, S64_MIN, S64_MIN, true, false, true, true}, + {-1, S64_MAX, S64_MAX-1, S64_MIN, -S64_MAX, -1, false, false, false, true}, + {S64_MAX, -1, S64_MAX-1, S64_MIN, -S64_MAX, S64_MAX, false, true, false, true}, + {-1, -S64_MAX, S64_MIN, S64_MAX-1, S64_MAX, -1, false, false, false, true}, + {-S64_MAX, -1, S64_MIN, S64_MIN+2, S64_MAX, -S64_MAX, false, false, false, true}, + + {1, S64_MIN, -S64_MAX, -S64_MAX, S64_MIN, 1, false, true, false, true}, + {S64_MIN, 1, -S64_MAX, S64_MAX, S64_MIN, 0, false, true, false, true}, + {1, S64_MAX, S64_MIN, S64_MIN+2, S64_MAX, 1, true, false, false, true}, + {S64_MAX, 1, S64_MIN, S64_MAX-1, S64_MAX, -2, true, false, false, true}, + + {S64_MIN, S64_MIN, 0, 0, 0, S64_MIN, true, false, true, true}, + {S64_MAX, S64_MAX, -2, 0, 1, S64_MAX, true, false, true, true}, + + {-1, -1, -2, 0, 1, -1, false, false, false, true}, + {-1, -128, -129, 127, 128, -1, false, false, false, true}, + {-128, -1, -129, -127, 128, -128, false, false, false, true}, + {0, -S64_MAX, -S64_MAX, S64_MAX, 0, 0, false, false, false, true}, }; #define check_one_op(t, fmt, op, sym, a, b, r, of) do { \ @@ -244,6 +246,7 @@ static int __init do_test_ ## t(const struct test_ ## t *p) \ check_one_op(t, fmt, sub, "-", p->a, p->b, p->diff, p->d_of); \ check_one_op(t, fmt, mul, "*", p->a, p->b, p->prod, p->p_of); \ check_one_op(t, fmt, mul, "*", p->b, p->a, p->prod, p->p_of); \ + check_one_op(t, fmt, shift, "<<", p->a, p->b, p->shift, p->sh_of);\ \ return err; \ } \ -- 2.14.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html