Module Name: src
Committed By: isaki
Date: Sat Feb 14 08:46:02 UTC 2015
Modified Files:
src/tests/lib/libc/gen: t_randomid.c
Log Message:
uint64_t -> uint32_t. 32bit is sufficient in this case
and it improved the performance approx 7% on my 68030.
see also PR lib/49664.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/t_randomid.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/lib/libc/gen/t_randomid.c
diff -u src/tests/lib/libc/gen/t_randomid.c:1.3 src/tests/lib/libc/gen/t_randomid.c:1.4
--- src/tests/lib/libc/gen/t_randomid.c:1.3 Thu Jul 7 09:49:59 2011
+++ src/tests/lib/libc/gen/t_randomid.c Sat Feb 14 08:46:02 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: t_randomid.c,v 1.3 2011/07/07 09:49:59 jruoho Exp $ */
+/* $NetBSD: t_randomid.c,v 1.4 2015/02/14 08:46:02 isaki Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#define PERIOD 30000
-uint64_t last[65536];
+uint32_t last[65536];
ATF_TC(randomid_basic);
ATF_TC_HEAD(randomid_basic, tc)
@@ -50,13 +50,13 @@ ATF_TC_HEAD(randomid_basic, tc)
ATF_TC_BODY(randomid_basic, tc)
{
static randomid_t ctx = NULL;
- uint64_t lowest, n, diff;
+ uint32_t lowest, n, diff;
uint16_t id;
memset(last, 0, sizeof(last));
ctx = randomid_new(16, (long)3600);
- lowest = UINT64_MAX;
+ lowest = UINT32_MAX;
for (n = 0; n < 1000000; n++) {
id = randomid(ctx);
@@ -65,15 +65,15 @@ ATF_TC_BODY(randomid_basic, tc)
diff = n - last[id];
if (diff <= lowest) {
- if (lowest != UINT64_MAX)
- printf("id %5d: last call at %9"PRIu64
- ", current call %9"PRIu64
- " (diff %5"PRIu64"), "
- "lowest %"PRIu64"\n",
+ if (lowest != UINT32_MAX)
+ printf("id %5d: last call at %9"PRIu32
+ ", current call %9"PRIu32
+ " (diff %5"PRIu32"), "
+ "lowest %"PRIu32"\n",
id, last[id], n, diff, lowest);
ATF_REQUIRE_MSG(diff >= PERIOD,
- "diff (%"PRIu64") less than minimum "
+ "diff (%"PRIu32") less than minimum "
"period (%d)", diff, PERIOD);
lowest = diff;