From c2cd2300ab03a41999b8e4e38cf0d29abb786918 Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 8 Oct 2010 23:46:51 +0200 Subject: material structs finished... finally :( testing time now! --- lyt/common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lyt/common.h') 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'); -- cgit v1.2.3