First util functions, with corresponding unit test.

This commit is contained in:
Vreixo Formoso
2007-12-13 21:02:36 +01:00
parent 60d68df84c
commit 115da82c9e
6 changed files with 80 additions and 3 deletions

19
src/util.c Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2007 Vreixo Formoso
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. See COPYING file for details.
*/
#include "util.h"
int div_up(int n, int div)
{
return (n + div - 1) / div;
}
int round_up(int n, int mul)
{
return div_up(n, mul) * mul;
}