On Thu, 8 Jul 2004, Sridhar Adagada wrote: > As you can see $6 is the length, my confusion is at the lines 12-14, > 19, 20 why is the length added with 65535 and the comparison with 0 It's not `added with 65535', but `ANDed with 65535'. MIPS32 has 32-bit integer operations only. If you want to do 16-bit math, all data has to be masked. Anyway, for performance, it's better to do 32-bit math only. > short cal_xxx(short *abs, short *coef, short len, short base) > { > short i; > short sum = 0; > > for (i = 0; i < length; i++) > { > sum += ( (unsigned int)abs[i] * (unsigned int)coef[i] ); Why cast to unsigned int while sum is a short? Unless you really want to rely on sum being a short, you better make it int and do the truncation to short after the loop. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds