os/graphics/fbs/fontandbitmapserver/sfbs/CompressionBookmark.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // CompressionBookmark
    15 // 
    16 //
    17 
    18 #ifndef __COMPRESSIONBOOKMARK_H_
    19 #define __COMPRESSIONBOOKMARK_H_
    20 
    21 class TCompressionBookMark
    22 	{
    23 public:
    24 	TCompressionBookMark();
    25 
    26 public:
    27 	inline void CalculateCheckSum();
    28 	inline TBool IsCheckSumOk() const;
    29 	TInt iSrcDataOffset;
    30 	TInt iCursorPos;
    31 	TUint32 iCheckSum;
    32 	TInt iCheckSum2;
    33 
    34 	};
    35 
    36 inline TCompressionBookMark::TCompressionBookMark() :
    37 	iSrcDataOffset(0), iCursorPos(0)
    38 	{
    39 	CalculateCheckSum();
    40 	}
    41 
    42 inline void TCompressionBookMark::CalculateCheckSum()
    43 	{
    44 	iCheckSum=((TUint32) iSrcDataOffset)^((TUint32) iCursorPos);
    45 	iCheckSum2=(1-iSrcDataOffset)+(1-iCursorPos);
    46 	}
    47 
    48 inline TBool TCompressionBookMark::IsCheckSumOk() const
    49 	{
    50 	TBool check1=(iCheckSum==(((TUint32) iSrcDataOffset)^((TUint32) iCursorPos)));
    51 	TBool check2=(iCheckSum2==((1-iSrcDataOffset)+(1-iCursorPos)));
    52 	return (check1 && check2);
    53 	}
    54 
    55 
    56 #endif//__COMPRESSIONBOOKMARK_H_