diff options
author | James Slocum <j.m.slocum@gmail.com> | 2013-10-05 09:34:17 -0400 |
---|---|---|
committer | James Slocum <j.m.slocum@gmail.com> | 2013-10-05 09:34:17 -0400 |
commit | 14d36350f939a1c1bec906a65a50536d80780ab9 (patch) | |
tree | 3d7e6d6892e4bf13ec1da07305f63e80cb168296 | |
parent | 09e6cee447976db456aabff9682e2945aa3abac1 (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.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 */ |