04-12-2006 12:11 AM
04-12-2006 10:33 AM - edited 04-12-2006 10:33 AM
Message Edited by mvr on 04-12-2006 10:34 AM
04-12-2006 09:09 PM
04-13-2006 11:57 AM
Hello,
I don’t think you can really “restrict” the datatype of an array, since it can’t change anyway. I don’t know exactly how the conversion from the “U8” takes place, but with 8-bit characters the problem comes from come from some typecast/conversion from your unsigned to a signed char. If you go from an unsigned char for example to a signed int, the sign is not extended:
#include <utility.h>
static unsigned char a = 255;
DebugPrintf ("%i", ((int) a));
If, however, you cast a unsigned char to a signed char and then cast that signed char to a signed int, it will be treated as a (-) number and converted:
#include <utility.h>
static unsigned char a = 255;
static char z;
z = (char) a;
DebugPrintf ("%i", ((int) z));
The solution is to find where that conversion takes place, and eliminate/change it. You could also modify your program to use a different type of array from the start to eliminate the conversions.
Hope it helps-