os/security/crypto/weakcryptospi/source/bigint/stackinteger.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcryptospi/source/bigint/stackinteger.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,59 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* TStackInteger class implementation
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file 
    1.25 + @internalComponent
    1.26 +*/
    1.27 + 
    1.28 +#ifndef __STACK_INTEGER_H__
    1.29 +#define __STACK_INTEGER_H__
    1.30 +
    1.31 +#include "bigint.h"
    1.32 +
    1.33 +/** An integer that can be created on the stack.\n\n
    1.34 + * The resulting integers are
    1.35 + * fixed in size and any code that tries to modify their memory allocation
    1.36 + * will panic.  Stack based integers may be modified as long as you can
    1.37 + * guarantee that the resulting integer will fit in the current amount of
    1.38 + * allocated memory.
    1.39 + * If you are not sure which integer you want, you want an RInteger.
    1.40 + * @internalComponent
    1.41 + * @released
    1.42 + * @see RInteger
    1.43 + */
    1.44 +template <TUint W=2> 
    1.45 +class TStackInteger : public TInteger
    1.46 +	{
    1.47 +public:
    1.48 +	inline TStackInteger<W>(TUint aInteger) {ConstructStack(W, aInteger);}
    1.49 +	inline TStackInteger<W>(const TInteger& aInteger) {ConstructStack(W, aInteger);}
    1.50 +protected:
    1.51 +	TUint32 iBuf[W];
    1.52 +	};
    1.53 +
    1.54 +typedef TStackInteger<2> TStackInteger64;
    1.55 +typedef TStackInteger<4> TStackInteger128;
    1.56 +typedef TStackInteger<8> TStackInteger256;
    1.57 +typedef TStackInteger<16> TStackInteger512;
    1.58 +typedef TStackInteger<32> TStackInteger1024;
    1.59 +typedef TStackInteger<64> TStackInteger2048;
    1.60 +//Don't make them any bigger than this :).  The last one is 66 words (264 bytes)
    1.61 +
    1.62 +#endif // __STACK_INTEGER_H__