mkfs_ext2: code shrink

function                                             old     new   delta
div_roundup                                            -      15     +15
mkfs_ext2_main                                      1980    1933     -47

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2009-10-17 23:27:29 +02:00
parent 7d8ab846d1
commit 9c2708ebf9

View File

@ -59,16 +59,16 @@ struct ext2_dir {
char name3[12]; char name3[12];
}; };
static inline int int_log2(int arg) static unsigned int_log2(unsigned arg)
{ {
int r = 0; unsigned r = 0;
while ((arg >>= 1) != 0) while ((arg >>= 1) != 0)
r++; r++;
return r; return r;
} }
// taken from mkfs_minix.c. libbb candidate? // taken from mkfs_minix.c. libbb candidate?
static ALWAYS_INLINE unsigned div_roundup(uint32_t size, uint32_t n) static unsigned div_roundup(uint32_t size, uint32_t n)
{ {
return (size + n-1) / n; return (size + n-1) / n;
} }