X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/0f00dc4c8eb47e67bc0f148c2dd109f73a451e0a..ce7001d8ef72928ff966e3c9da1c62ce1d00d2c0:/symm/blkc.h diff --git a/symm/blkc.h b/symm/blkc.h index d6e3da0f..ff631f09 100644 --- a/symm/blkc.h +++ b/symm/blkc.h @@ -174,7 +174,7 @@ unsigned _i; BLKC_W(w); unsigned long _x = x; \ for (_i = 0; _i < PRE##_BLKSZ / 4; _i++) { \ *_w++ = U32(_x); \ - _x = ((_x & ~MASK32) >> 16) >> 16; \ + _x = ((_x & ~(unsigned long)MASK32) >> 16) >> 16; \ } \ } while (0) @@ -182,7 +182,7 @@ unsigned _i; BLKC_W(w); unsigned long _x = x; _w += PRE##_BLKSZ / 4; \ for (_i = 0; _i < PRE##_BLKSZ / 4; _i++) { \ *--_w = U32(_x); \ - _x = ((_x & ~MASK32) >> 16) >> 16; \ + _x = ((_x & ~(unsigned long)MASK32) >> 16) >> 16; \ } \ } while (0) @@ -260,7 +260,9 @@ #include #include -#define BLKC_VERIFY(PRE, pre) \ +#define BLKC_VERIFY(PRE, pre) BLKC_VERIFYX(PRE, pre, #pre) + +#define BLKC_VERIFYX(PRE, pre, name) \ \ static int pre##_verify(dstr *v) \ { \ @@ -316,26 +318,32 @@ static int pre##_verify(dstr *v) \ return (ok); \ } -#define BLKC_TEST(PRE, pre) \ +#define BLKC_TESTDEFS(PRE, pre) BLKC_TESTDEFSX(PRE, pre, #pre) + +#define BLKC_TESTDEFSX(PRE, pre, name) \ + { name, pre##_verify, { &type_hex, &type_hex, &type_hex, 0 } }, + +#define BLKC_TESTX(PRE, pre, name, fname) \ \ -BLKC_VERIFY(PRE, pre) \ +BLKC_VERIFYX(PRE, pre, name) \ \ static const test_chunk defs[] = { \ - { #pre, pre##_verify, { &type_hex, &type_hex, &type_hex, 0 } }, \ + BLKC_TESTDEFSX(PRE, pre, name) \ { 0, 0, { 0 } } \ }; \ \ int main(int argc, char *argv[]) \ { \ - test_run(argc, argv, defs, SRCDIR"/t/" #pre); \ + test_run(argc, argv, defs, SRCDIR"/t/" fname); \ return (0); \ } #else -# define BLKC_VERIFY(PRE, pre) -# define BLKC_TEST(PRE, pre) +# define BLKC_TESTX(PRE, pre, name, fname) #endif +#define BLKC_TEST(PRE, pre) BLKC_TESTX(PRE, pre, #pre, #pre) + /*----- That's all, folks -------------------------------------------------*/ #ifdef __cplusplus