From 14d36350f939a1c1bec906a65a50536d80780ab9 Mon Sep 17 00:00:00 2001 From: James Slocum Date: Sat, 5 Oct 2013 09:34:17 -0400 Subject: Bug Fix: advance was not guaranteed to be divisable by long_size, changed the MBLOCK test by convering to char* arrays and tracking bytes. --- mbw.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mbw.c') diff --git a/mbw.c b/mbw.c index 1c6fe63..89e6f8d 100644 --- a/mbw.c +++ b/mbw.c @@ -99,7 +99,6 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon unsigned int long_size=sizeof(long); /* array size in bytes */ unsigned long long array_bytes=asize*long_size; - unsigned int advance=block_size/long_size; if(type==1) { /* memcpy test */ /* timer starts */ @@ -108,12 +107,14 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon /* timer stops */ gettimeofday(&endtime, NULL); } else if(type==2) { /* memcpy block test */ + char* aa = (char*)a; + char* bb = (char*)b; gettimeofday(&starttime, NULL); - for (t=array_bytes; t >= block_size; t-=block_size, a+=advance){ - b=mempcpy(b, a, block_size); + for (t=array_bytes; t >= block_size; t-=block_size, a+=block_size){ + bb=mempcpy(bb, aa, block_size); } if(t) { - b=mempcpy(b, a, t); + bb=mempcpy(bb, aa, t); } gettimeofday(&endtime, NULL); } else { /* dumb test */ -- cgit v1.2.3