1
0
forked from 0ad/0ad
0ad/source/lib/file/io/io_align.cpp
janwas 58360a629c - fix incorrect use of block vs. sector aligned (both offset and length must be block-aligned to allow proper caching)
- use helper functions to reduce occurrences of BLOCK_SIZE and
SECTOR_SIZE
- wmi: provide for shutting it down (gets rid of its two threads); only
initialize if actually needed (costs 200ms)
- ogl_tex: don't complain if there's no gfx_card info (due to not having
used wmi)

This was SVN commit r5572.
2008-01-20 21:52:54 +00:00

24 lines
397 B
C++

#include "precompiled.h"
#include "io_align.h"
bool IsAligned_Offset(off_t ofs)
{
return IsAligned(ofs, BLOCK_SIZE);
}
off_t AlignedOffset(off_t ofs)
{
return round_down(ofs, BLOCK_SIZE);
}
off_t AlignedSize(off_t size)
{
return round_up(size, BLOCK_SIZE);
}
off_t PaddedSize(off_t size, off_t ofs)
{
return round_up(size + ofs - AlignedOffset(ofs), BLOCK_SIZE);
}