diff options
author | Treeki <treeki@gmail.com> | 2010-10-08 23:46:51 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2010-10-08 23:46:51 +0200 |
commit | c2cd2300ab03a41999b8e4e38cf0d29abb786918 (patch) | |
tree | 8b03994c84a9e7b2be0a6c39d9c85bec7315575a /lyt/common.h | |
parent | b92673def2816cf8010997c87368d7045944ce63 (diff) | |
download | LayoutStudio-c2cd2300ab03a41999b8e4e38cf0d29abb786918.tar.gz LayoutStudio-c2cd2300ab03a41999b8e4e38cf0d29abb786918.zip |
material structs finished... finally :( testing time now!
Diffstat (limited to 'lyt/common.h')
-rw-r--r-- | lyt/common.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lyt/common.h b/lyt/common.h index 2cddffd..c75813b 100644 --- a/lyt/common.h +++ b/lyt/common.h @@ -49,6 +49,20 @@ inline quint32 BitExtract(quint32 value, int count, int start) { return (value & mask) >> (32 - (start + count)); } +inline quint32 BitInsert(quint32 value, int newValue, int count, int start) { + quint32 mask = 0; + for (int i = start; i < start+count; i++) { + mask |= (0x80000000 >> i); + } + + value &= ~mask; + value |= (newValue << (32 - (start + count))) & mask; + return value; +} + + + + QByteArray PadByteArray(QByteArray original, int newLength, char padWith='\0'); |