⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vmlargeintmath.h

📁 TOOL (Tiny Object Oriented Language) is an easily-embedded, object-oriented, C++-like-language inter
💻 H
字号:
#ifndef VM_LARGE_INT_MATH_H_INCLUDED
#define VM_LARGE_INT_MATH_H_INCLUDED
/*****************************************************************************/
/*                              HEADER FILE                                  */
/*****************************************************************************/
/*
       $Archive:   $

      $Revision:   $
          $Date:   $
        $Author:   $

    Description:   Declaration of a set of math operations for large integers

                      TOOL And XML FORMS License
                      ==========================

                      Except where otherwise noted, all of the documentation 
                      and software included in the TOOL package is 
                      copyrighted by Michael Swartzendruber.

                      Copyright (C) 2005 Michael John Swartzendruber. 
                      All rights reserved.

                      Access to this code, whether intentional or accidental,
                      does NOT IMPLY any transfer of rights.

                      This software is provided "as-is," without any express 
                      or implied warranty. In no event shall the author be held
                      liable for any damages arising from the use of this software.

                      Permission is granted to anyone to use this software for 
                      any purpose, including commercial applications, and to 
                      alter and redistribute it, provided that the following 
                      conditions are met:

                      1. All redistributions of source code files must retain 
                         all copyright notices that are currently in place, 
                         and this list of conditions without modification.

                      2. The origin of this software must not be misrepresented;
                         you must not claim that you wrote the original software.

                      3. If you use this software in another product, an acknowledgment
                         in the product documentation would be appreciated but is
                         not required.

                      4. Modified versions in source or binary form must be plainly 
                         marked as such, and must not be misrepresented as being 
                         the original software.
*/
/*****************************************************************************/


#include "../../../stdafx.h"

#define VMLargeIntGreaterThan( X, Y ) \
        ( ( ( ( X ).HighPart == ( Y ).HighPart ) \
        && ( ( X ).LowPart > ( Y ).LowPart ) ) || ( ( X ).HighPart > ( Y ).HighPart ) )

#define VMLargeIntGreaterThanOrEqualTo( X, Y ) \
        ( ( ( ( X ).HighPart == ( Y ).HighPart ) \
        && ( ( X ).LowPart >= ( Y ).LowPart)) || ( ( X ).HighPart > ( Y ).HighPart ) )

#define VMLargeIntEqualTo( X, Y ) \
        ( !( ( ( X ).LowPart ^ ( Y ).LowPart ) | ( ( X ).HighPart ^ ( Y ).HighPart ) ) )

#define VMLargeIntNotEqualTo( X, Y ) \
        ( ( ( ( X ).LowPart ^ ( Y ).LowPart) | ( ( X ).HighPart ^ ( Y ).HighPart ) ) )

#define VMLargeIntLessThan( X, Y ) \
        ( ( ( ( X ).HighPart == ( Y ).HighPart ) \
        && ( ( X ).LowPart < ( Y ).LowPart ) ) || ( ( X ).HighPart < ( Y ).HighPart ) )

#define VMLargeIntLessThanOrEqualTo( X, Y ) \
        ( ( ( ( X ).HighPart == ( Y ).HighPart ) \
        && ( ( X ).LowPart <= ( Y ).LowPart ) ) || ( ( X ).HighPart < ( Y ).HighPart ) )

#define VMLargeIntGreaterOrEqualToZero( X ) \
        ( ( X ).HighPart >= 0 )

#define VMLargeIntEqualToZero( X ) \
        ( !( ( X ).LowPart | ( X ).HighPart ) )

#define VMLargeIntNotEqualToZero( X ) \
        ( ( ( X ).LowPart | ( X ).HighPart ) )

#define VMLargeIntLessOrEqualToZero( X ) \
        ( ( ( X ).HighPart < 0 ) || !( ( X ).LowPart | ( X ).HighPart ) )

#define VMLargeIntGreaterThanZero( X ) \
        ( ( ( ( X ).HighPart == 0 ) && ( ( X ).LowPart > 0 ) ) || ( ( X ).HighPart > 0 ) )

#define VMLargeIntLessThanZero( X ) \
        ( ( ( X ).HighPart < 0 ) )


extern LARGE_INTEGER VMLargeIntZero;

LARGE_INTEGER VMLargeIntAssign( ULONG ulValue );

LARGE_INTEGER VMLargeIntShiftRight( LARGE_INTEGER xValue, CCHAR chShift );

LARGE_INTEGER VMLargeIntMultiply( ULONG ulValueOne, ULONG ulValueTwo );

LARGE_INTEGER VMLargeIntMultiply( LONG lValueOne, LONG lValueTwo );

LARGE_INTEGER VMLargeIntDivide( LARGE_INTEGER xDividend, LARGE_INTEGER xDivisor, LARGE_INTEGER* pxRemainder = NULL );

LARGE_INTEGER VMLargeIntDivide( LARGE_INTEGER xDividend, ULONG ulDivisor, ULONG* pulRemainder = NULL );

LARGE_INTEGER VMLargeIntAdd( LARGE_INTEGER xValueOne, LARGE_INTEGER xValueTwo );

LARGE_INTEGER VMLargeIntSubtract(LARGE_INTEGER xValueOne, LARGE_INTEGER xValueTwo );

LARGE_INTEGER VMLargeIntNegate( LARGE_INTEGER xValue );

char* VMLargeIntAsString( char* pchBuffer, LARGE_INTEGER xValue );


#endif


/*****************************************************************************/
/* Check-in history */
/*
 *$Log:  $
*/
/*****************************************************************************/


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -