#ifndef _MWORD_H_INCLUDE
#define _MWORD_H_INCLUDE
#ifndef INT64
#if defined(WIN32)
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
#else
typedef unsigned long long UINT64;
typedef long long INT64;
#endif
#endifstruct MWORD
{
enum
{
MAXBASE = 0x1FFFFFFF,
}; int m_nBase:30;
unsigned int m_nMul:2; MWORD(){};
MWORD(int n);
MWORD(int nBase,DWORD dwMul);
operator INT64() const { return GetValue();}
INT64 GetValue() const;
MWORD operator-=(const MWORD& d);
MWORD operator-=(const INT64 d);
MWORD operator+=(const MWORD& d);
MWORD operator+=(const INT64 d);
MWORD operator*=(const MWORD& d);
MWORD operator*=(const INT64 d);
MWORD operator/=(const MWORD& d);
MWORD operator/=(const INT64 d);
INT64 operator+(const MWORD& d) const;
INT64 operator-(const MWORD& d) const;
INT64 operator*(const MWORD& d) const;
INT64 operator/(const MWORD& d) const;
INT64 operator+(const int d) const;
INT64 operator-(const int d) const;
INT64 operator*(const int d) const;
INT64 operator/(const int d) const;
MWORD operator=(const MWORD& d);
MWORD operator=(const INT64 d);
BOOL operator==(const MWORD& d) const;
BOOL operator==(const INT64 d) const;
BOOL operator==(const int d) const;
BOOL operator!=(const MWORD& d) const;
BOOL operator!=(const INT64 d) const;
BOOL operator!=(const int d) const;
BOOL operator>(int d) const;
BOOL operator>(MWORD d) const;
BOOL operator<(int d) const;
BOOL operator<(MWORD d) const;
BOOL IsZero() const {return m_nBase==0;}
unsigned int GetMul(){return m_nMul;}
unsigned int GetBase(){return m_nBase;}
DWORD GetRawData(){return *(DWORD*)this;}
void SetRawData(DWORD dw){*(DWORD*)this = dw;}
};#endif //_MWORD_H_INCLUDE我只能看懂部分,这个数据的长度是32位,但是具体如何按位计算数据值就看不懂了,请指点

解决方案 »

  1.   

    如果可以的话顺带翻译成DELPHI里用的语法,就感激不尽啦
      

  2.   

    这个struct其实就是个类,唯一不同的是没有private等限制符。而且这也不是一个C语言类型,而是一个典型的C++类型。因为Delphi中没有所谓的操作符重载,这个类无法转换为Delphi中的类
      

  3.   

    这几句DELPHI里怎么表示?
    #ifndef INT64
    #if defined(WIN32)
    typedef unsigned __int64 UINT64;
    typedef __int64 INT64;
    #else
    typedef unsigned long long UINT64;
    typedef long long INT64;
    #endif
    #endif
      

  4.   

    可以翻译为Delphi代码,不过,只有Delphi 2006的编译器支持。翻译成Record就可以重载运算符(class则不能重载)。语法比较麻烦。你自己看看Delphi 2006的帮助。#ifndef INT64
    #if defined(WIN32)
    typedef unsigned __int64 UINT64;
    typedef __int64 INT64;
    #else
    typedef unsigned long long UINT64;
    typedef long long INT64;
    #endif
    #endif
    条件编译Delphi也支持。不过,我不知道用什么方法代替typedef。
      

  5.   

    typedef就是命个别名,好记,好写或者是更能表达意思一些
      

  6.   

    typedef 相当于DELPH中的typec中:
    typedef void abc(void); 后,abc就是一个类型了(函数指针类型).
    等于下面:
    type
      abc = function; stdcall;
      

  7.   

    我知道条件编译DELPHI支持的啦只是不知道那些C语言中的表示方法到DELPHI里应该如何表示,请直接把这段话翻译成DELPHI的表达方式吧#ifndef INT64
    #if defined(WIN32)
    typedef unsigned __int64 UINT64;
    typedef __int64 INT64;
    #else
    typedef unsigned long long UINT64;
    typedef long long INT64;
    #endif
    #endif