mkfs_ext2: fix a buglet introduced in last commit
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 17 Oct 2009 21:23:45 +0000 (23:23 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 17 Oct 2009 21:23:45 +0000 (23:23 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
util-linux/mkfs_ext2.c

index e4c3e171e76c90d2a11f0c5464d8b767989fedd4..41f37c2874838a72cdb1969f628d559f624c956f 100644 (file)
@@ -112,11 +112,14 @@ static uint32_t has_super(uint32_t x)
                48828125, 129140163, 244140625, 282475249, 387420489,
                1162261467, 1220703125, 1977326743, 3486784401/* >2^31 */,
        };
-       unsigned i;
-       for (i = ARRAY_SIZE(supers); --i >= 0;)
-               if (x == supers[i])
+       const uint32_t *sp = supers + ARRAY_SIZE(supers)-1;
+       while (1) {
+               if (x == *sp)
                        return 1;
-       return 0;
+               if (0 == *sp)
+                       return 0;
+               sp--;
+       }
 }
 #endif