Implement Writer for file contents.

Some aspects, such as better reporting of file bigger or smaller than 
expected is needed, but all situations are handled propertly.
This commit is contained in:
Vreixo Formoso
2007-12-20 22:17:18 +01:00
parent 449ed65fe9
commit 2f383215ff
7 changed files with 238 additions and 51 deletions

View File

@ -20,9 +20,15 @@
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
extern inline int div_up(int n, int div);
extern inline int div_up(unsigned int n, unsigned int div)
{
return (n + div - 1) / div;
}
extern inline int round_up(int n, int mul);
extern inline int round_up(unsigned int n, unsigned int mul)
{
return div_up(n, mul) * mul;
}
int int_pow(int base, int power);