From fdf8cfec2b795393d7ee901abaf747575067068b Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 14 Oct 2010 03:15:41 +0200 Subject: bugfixes; working U8 archive support for reading/writing --- wii/common.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'wii/common.h') diff --git a/wii/common.h b/wii/common.h index aa7dce0..34f1526 100644 --- a/wii/common.h +++ b/wii/common.h @@ -10,6 +10,15 @@ #include #include +inline quint32 AlignUp(quint32 value, quint32 alignTo) { + return (value + alignTo - 1) & ~(alignTo - 1); +} + +inline quint32 AlignDown(quint32 value, quint32 alignTo) { + return value & ~(alignTo - 1); +} + + inline quint32 BitExtract(quint32 value, int count, int start) { // this function relies on heavy compiler optimisation to be efficient :p quint32 mask = 0; @@ -31,6 +40,10 @@ inline quint32 BitInsert(quint32 value, int newValue, int count, int start) { return value; } +inline void WritePadding(int num, QDataStream &out) { + for (int i = 0; i < num; i++) + out << (quint8)0; +} -- cgit v1.2.3