diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-24 09:26:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-24 09:26:44 +0000 |
commit | 3bbb7d09f0f2d5f07a3ad7f90b179ddc6831f9a3 (patch) | |
tree | e7763da882d38eeebd72fa49e0bbb4edc5b84842 /src/util/common_allocation.c | |
parent | 6f191f08a947e08d5d8ff842a29ba6f4b6611603 (diff) | |
download | gnunet-3bbb7d09f0f2d5f07a3ad7f90b179ddc6831f9a3.tar.gz gnunet-3bbb7d09f0f2d5f07a3ad7f90b179ddc6831f9a3.zip |
-speeding up baadf00d code by 7x (on i7)
Diffstat (limited to 'src/util/common_allocation.c')
-rw-r--r-- | src/util/common_allocation.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index ab8715a6d..1828d826a 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -222,11 +222,14 @@ GNUNET_xfree_ (void *ptr, const char *filename, int linenumber) | |||
222 | #if defined(M_SIZE) | 222 | #if defined(M_SIZE) |
223 | #if ENABLE_POISONING | 223 | #if ENABLE_POISONING |
224 | { | 224 | { |
225 | const uint64_t baadfood = GNUNET_ntohll (0xBAADF00DBAADF00DLL); | ||
226 | uint64_t *base = ptr; | ||
227 | size_t s = M_SIZE (ptr); | ||
225 | size_t i; | 228 | size_t i; |
226 | char baadfood[5] = BAADFOOD_STR; | 229 | |
227 | size_t s = M_SIZE (ptr); | 230 | for (i=0;i<s/8;i++) |
228 | for (i = 0; i < s; i++) | 231 | base[i] = baadfood; |
229 | ((char *) ptr)[i] = baadfood[i % 4]; | 232 | memcpy (&base[s/8], &baadfood, s % 8); |
230 | } | 233 | } |
231 | #endif | 234 | #endif |
232 | #endif | 235 | #endif |