>On Thu, 07 Jun 2007 13:39:39 -0500 (while OU was sucking), Ron
>Blancarte wrote:
>>unsigned char inputBuffer[100];
unsigned char outputBuffer[100];
[then outputBuffer[] size increased and the other replaced, viz:
unsigned char outputBuffer[200];
unsigned char *inputBuffer = outputBuffer + 100;
]
In article <0v************ *************** *****@4ax.com>
Ron Blancarte <ron@---TAKETHISOUT---.blancarte.comw rote:
>ONE THING!!
I don't know if this makes a difference or not, BUT...
I forgot to mention, inputBuffer and outputBuffer are both global.
They are being accessed via extern in the SPI routines. Will this
make any sort of differnce?
I am going to make a wild guess at the problem: you changed
the actual definitions of the two variables, but somewhere else
-- where they are used, as these "global" variables -- you left
in *declarations* of the form:
extern char inputBuffer[];
extern char outputBuffer[];
Since arrays are not pointers (nor vice versa), this causes
references of the form:
inputBuffer[i]
to generate "array access" instructions instead of the "pointer
accesss" instructions now need. (See the FAQ, section 6.)
Note that you may be able to get "better" (for some definition
of "better") code by writing:
unsigned char outputBuffer[200];
#define inputBuffer (&outputBuffe r[100])
and/or using (off-topic, but probably-available) assembler or
linker tricks to make the two buffers overlap. That is, on some
microprocessors , if some variable A is an array while some other
variable p is a pointer pointing into that array -- e.g.:
char A[100];
char *p = &A[0];
-- then, on that machine, the code generated for:
op(A[i])
is shorter and/or faster than that for:
op(p[i])
for most operations "op". (On other machines, it is a wash, and
in some cases, the pointer may be "better". The definition of
"better" is rather fuzzy in the first place, so this is something
that has to be defined clearly, then measured.)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.