1#ifndef UTILS_RSH 2#define UTILS_RSH 3 4#define RS_MSG_TEST_PASSED 100 5#define RS_MSG_TEST_FAILED 101 6 7#define DEFINE_CHECK(T) \ 8 static int __attribute__((overloadable)) \ 9 checkEq(T expected, T actual) { \ 10 return (expected == actual); \ 11 } 12 13#define DEFINE_CHECK2(T) \ 14 static int __attribute__((overloadable)) \ 15 checkEq(T##2 expected, T##2 actual) { \ 16 return (expected.x == actual.x && expected.y == actual.y); \ 17 } 18 19#define DEFINE_CHECK4(T) \ 20 static int __attribute__((overloadable)) \ 21 checkEq(T##4 expected, T##4 actual) { \ 22 return (expected.x == actual.x && \ 23 expected.y == actual.y && \ 24 expected.z == actual.z && \ 25 expected.w == actual.w); \ 26 } 27 28#define DEFINE_GET(T) \ 29 static T __attribute__((overloadable)) \ 30 get_##T(rs_allocation a, int x) { \ 31 return rsGetElementAt_##T(a, x); \ 32 } 33 34#define HANDLE_TYPE(T) \ 35 DEFINE_GET(T) \ 36 DEFINE_CHECK(T) \ 37 DEFINE_TEST(T) \ 38 DEFINE_GET(T##2) \ 39 DEFINE_CHECK2(T) \ 40 DEFINE_TEST(T##2) \ 41 DEFINE_GET(T##4) \ 42 DEFINE_CHECK4(T) \ 43 DEFINE_TEST(T##4) \ 44 45#endif // UTILS_RSH 46