Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/14/00 20:12
Read: times


 
#7297 - xdata question using Keil v6
I have some code listed below that I believe is inefficient, or written strangely. Even if "mystring" is declared as an xdata item, why is the code in the function using local variables declared as xdata? Can anybody revise this code to make it more efficient? Thanks in advance.

typedef struct struct_string_tag
{
unsigned char size; // current number of elements used
unsigned char val[21]; // storage area
} mystring;

mystring xdata s;

long value(mystring *s)
{
int xdata i;
long xdata result=0; // holds the accumulated result

for (i=0; i<(x->size); i++)
{
result <<= 8; // shift the accumulated result
result += x->val[i]; // add the next byte
}

return result;
}



List of 4 messages in thread
TopicAuthorDate
xdata question using Keil v6            01/01/70 00:00      
RE: xdata question using Keil v6            01/01/70 00:00      
RE: xdata question using Keil v6            01/01/70 00:00      
RE: xdata question using Keil v6            01/01/70 00:00      

Back to Subject List