summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Slocum <j.m.slocum@gmail.com>2013-10-05 09:34:17 -0400
committerJames Slocum <j.m.slocum@gmail.com>2013-10-05 09:34:17 -0400
commit14d36350f939a1c1bec906a65a50536d80780ab9 (patch)
tree3d7e6d6892e4bf13ec1da07305f63e80cb168296
parent09e6cee447976db456aabff9682e2945aa3abac1 (diff)
Bug Fix: advance was not guaranteed to be divisable by long_size, changed the MBLOCK test by convering to char* arrays and tracking bytes.
-rw-r--r--mbw.c9
1 files changed, 5 insertions, 4 deletions
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 */