[ECOS] catch bug
Gary Thomas
gthomas@redhat.com
Tue Oct 23 21:21:00 GMT 2001
On Wed, 2001-10-24 at 12:39, james chen wrote:
> Hi,
> I have caught a bug in hal/arm/arch/current/src/hal_misc.c. I think that
> it haven't been found because nobody called it. change 'i++' to 'i--", is it
> right?
> Best Regards,
> james
>
> -------------------------------------
> int
> hal_msbindex(int mask)
> {
> int i;
> for (i = 32; i >= 0; i++) {
> ^^^^^^
> ==> i--
> if (mask & (1<<i)) return (i);
> }
> return (-1);
> }
>
Close. Indeed, this function must not get used because it was
quite wrong (two errors!) It will be corrected as:
Index: hal/arm/arch/current/src/hal_misc.c
===================================================================
RCS file: /home/cvs/ecc/ecc/hal/arm/arch/current/src/hal_misc.c,v
retrieving revision 1.40
diff -u -5 -p -r1.40 hal_misc.c
--- hal/arm/arch/current/src/hal_misc.c 16 Jul 2001 13:15:36 -0000 1.40
+++ hal/arm/arch/current/src/hal_misc.c 24 Oct 2001 04:12:32 -0000
@@ -250,11 +250,11 @@ hal_lsbindex(int mask)
int
hal_msbindex(int mask)
{
int i;
- for (i = 32; i >= 0; i++) {
+ for (i = 31; i >= 0; i--) {
if (mask & (1<<i)) return (i);
}
return (-1);
}
More information about the Ecos-discuss
mailing list