diff options
author | Treeki <treeki@gmail.com> | 2010-10-14 03:15:41 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2010-10-14 03:15:41 +0200 |
commit | fdf8cfec2b795393d7ee901abaf747575067068b (patch) | |
tree | 1eb3a65765c1c43c4ea91530462cd15d54f995d1 /wii/common.h | |
parent | 7213ca723a65dff8ebb0c6c08669695217e60453 (diff) | |
download | LayoutStudio-fdf8cfec2b795393d7ee901abaf747575067068b.tar.gz LayoutStudio-fdf8cfec2b795393d7ee901abaf747575067068b.zip |
bugfixes; working U8 archive support for reading/writing
Diffstat (limited to 'wii/common.h')
-rw-r--r-- | wii/common.h | 13 |
1 files changed, 13 insertions, 0 deletions
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 <QtCore/QDebug> #include <QtCore/QVector> +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; +} |