crypto/weakcryptospi/source/bigint/stackinteger.h
changeset 17 cd501b96611d
child 62 b23410e29e22
equal deleted inserted replaced
15:da2ae96f639b 17:cd501b96611d
       
     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  @file 
       
    22  @internalComponent
       
    23 */
       
    24  
       
    25 #ifndef __STACK_INTEGER_H__
       
    26 #define __STACK_INTEGER_H__
       
    27 
       
    28 #include "bigint.h"
       
    29 
       
    30 /** An integer that can be created on the stack.\n\n
       
    31  * The resulting integers are
       
    32  * fixed in size and any code that tries to modify their memory allocation
       
    33  * will panic.  Stack based integers may be modified as long as you can
       
    34  * guarantee that the resulting integer will fit in the current amount of
       
    35  * allocated memory.
       
    36  * If you are not sure which integer you want, you want an RInteger.
       
    37  * @internalComponent
       
    38  * @prototype
       
    39  * @see RInteger
       
    40  */
       
    41 template <TUint W=2> 
       
    42 class TStackInteger : public TInteger
       
    43 	{
       
    44 public:
       
    45 	inline TStackInteger<W>(TUint aInteger) {ConstructStack(W, aInteger);}
       
    46 	inline TStackInteger<W>(const TInteger& aInteger) {ConstructStack(W, aInteger);}
       
    47 protected:
       
    48 	TUint32 iBuf[W];
       
    49 	};
       
    50 
       
    51 typedef TStackInteger<2> TStackInteger64;
       
    52 typedef TStackInteger<4> TStackInteger128;
       
    53 typedef TStackInteger<8> TStackInteger256;
       
    54 typedef TStackInteger<16> TStackInteger512;
       
    55 typedef TStackInteger<32> TStackInteger1024;
       
    56 typedef TStackInteger<64> TStackInteger2048;
       
    57 //Don't make them any bigger than this :).  The last one is 66 words (264 bytes)
       
    58 
       
    59 #endif // __STACK_INTEGER_H__