So I have a function which takes in a 2d array as a parameter and sets its value by copying another (locally declared) 2d array like this (both 2d arrays of unsigned chars):
but this is massively slowing my program.Code:for (int tempcol=0;tempcol<4;tempcol++) { for (int temprow=0;temprow<4;temprow++) { charstate [temprow][tempcol]=tempstate[temprow[tempcol]; } }
Doing this takes a fraction of the time:
Why is this? Any solutions to speeding up my application?Code:unsigned char test=12; for (int tempcol=0;tempcol<4;tempcol++) { for (int temprow=0;temprow<4;temprow++) { charstate [temprow][tempcol] =test; } }
Thanks!



1Likes
LinkBack URL
About LinkBacks



