crypto/weakcrypto/source/bigint/stackinteger.h
changeset 0 2c201484c85f
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * TStackInteger class implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file 
       
    24  @internalComponent
       
    25 */
       
    26  
       
    27 #ifndef __STACK_INTEGER_H__
       
    28 #define __STACK_INTEGER_H__
       
    29 
       
    30 #include "bigint.h"
       
    31 
       
    32 /** An integer that can be created on the stack.\n\n
       
    33  * The resulting integers are
       
    34  * fixed in size and any code that tries to modify their memory allocation
       
    35  * will panic.  Stack based integers may be modified as long as you can
       
    36  * guarantee that the resulting integer will fit in the current amount of
       
    37  * allocated memory.  For integers that can dynamically grow see RInteger.
       
    38  * If you are not sure which integer you want, you want an RInteger.
       
    39  * @internalComponent
       
    40  * @interim
       
    41  * @see RInteger
       
    42  */
       
    43 template <TUint W=2> 
       
    44 class TStackInteger : public TInteger
       
    45 	{
       
    46 public:
       
    47 	inline TStackInteger<W>(TUint aInteger) {ConstructStack(W, aInteger);}
       
    48 	inline TStackInteger<W>(const TInteger& aInteger) {ConstructStack(W, aInteger);}
       
    49 protected:
       
    50 	TUint32 iBuf[W];
       
    51 	};
       
    52 
       
    53 typedef TStackInteger<2> TStackInteger64;
       
    54 typedef TStackInteger<4> TStackInteger128;
       
    55 typedef TStackInteger<8> TStackInteger256;
       
    56 typedef TStackInteger<16> TStackInteger512;
       
    57 typedef TStackInteger<32> TStackInteger1024;
       
    58 typedef TStackInteger<64> TStackInteger2048;
       
    59 //Don't make them any bigger than this :).  The last one is 66 words (264 bytes)
       
    60 
       
    61 #endif // __STACK_INTEGER_H__