sorry I wasn't following along in the book...so I'm lost.
But I wonder if using a long in the for() comparison is a problem.
Since you don't even have an int's worth of memory to iterate
through, you don't need range to be long. Might be worth a try,
or at least a poke into the assembler output.
MS
Aurélien Francillon wrote:
AIGroup a écrit :
I'm using only one sample to prevent too much computational cost.
I yet have the problem and today I have seen that most of these errors
is caused by automatic cast. If the cast is forced, most of this
events don't occur.
I hope to find a solution very soon!
Thanks for your time
long compute_index(long int *binfeature, long int range, long int
*index)
{
int i=0,ii=0;
/*THE PROBLEM IS HERE: IF I PUT A NUMBER (e.g. 2) INSTEAD OF
range THE
STATEMENT for WORKS WELL */
for(i=0;i<range;i++) /* <----T
{
if(binfeature[i])
{
>> index[ii]=i;
>> ii++;
etc...
...
hum to my opinon you should check here and in other places that you
don't overflow the array called "index" i.e. it depends on too much
magic to work reliably...
as a starter adding a manual check for "ii" to be in range of your array
might help?
Overflowing the array could very well lead to various kind of unreliable
and unexplicable behaviour as you may overwrite stack or other variables
...
cheers
Aurelien
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
--
Platform: WinXP/Cygwin
TinyOS version: 1.x, Boomerang
Programmer: MIB510
Device(s): Mica2, MicaZ, Tmote
Sensor board: homebrew
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help