After hours of debugging I found the reason my sorting algorithm didn't work.
With a given input of A[] = 1, 2, ..., N the following Kernel code gives us for n=16
sum_total1 = 136; // correct sum with faulty loop
sum_total2 = 135; // incorrect sum with correct loop
The error persists for larger N, but not for N=8 for example.
All tested on Juniper.
__private uint sum_total1 = 0ul; __private uint sum_total2 = 0ul; for( int i=N-1; i>=-1; --i ){ sum_total1 += A[ i ]; } for( int i=N-1; i>= 0; --i ){ sum_total2 += A[ i ]; }
that's strange. do you have problems with the >= comparator outside of for loop test clause?
Thanks for reporting this. I reproduced the problem and filed a bug.
Jeff
That's may be a bug in 2.2 SDK. In 2.1 SDK I see it still count down well.
hi all,
This is a known known issue and you can expect it to be fixed in future releases.
Thanks
hi all,
This is a known known issue and you can expect it to be fixed in future releases.
Thanks
Sorry for the double reply.