From bd82d030011cd8b9655e5ded6b6df9343b42a6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 4 Feb 2015 14:09:54 +0100 Subject: Imported Upstream version 3.22 --- src/tc-misc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/tc-misc.c (limited to 'src/tc-misc.c') diff --git a/src/tc-misc.c b/src/tc-misc.c new file mode 100644 index 0000000..cb985a3 --- /dev/null +++ b/src/tc-misc.c @@ -0,0 +1,46 @@ +/* + * Copyright Jan Engelhardt + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the WTF Public License version 2 or + * (at your option) any later version. + */ +#ifndef __cplusplus +# include +#else +# include +#endif +#include +#include +#include + +int main(int argc, const char **argv) +{ + unsigned int n; + struct stat sa, sb; + + if (HX_init() <= 0) + abort(); + printf("%d\n", HX_ffs(0)); + for (n = 1; ; n <<= 1) { + printf("%08x = %d\n", n, HX_ffs(n)); + if (n & 0x80000000) + break; + } + printf("---\n"); + for (n = 1; ; n <<= 1, n |= 1) { + printf("%08x = %d\n", n, HX_ffs(n)); + if (n == ~0U) + break; + } + + if (argc >= 3) { + if (stat(argv[1], &sa) < 0 || + stat(argv[2], &sb) < 0) + perror("stat"); + printf("Difference: %ld\n", HX_time_compare(&sa, &sb, 'm')); + } + + HX_exit(); + return EXIT_SUCCESS; +} -- cgit v1.2.3