?? __dword128.cpp
字號(hào):
// __DWORD128.cpp: implementation of the __DWORD128 class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SecretChat.h"
#include "__DWORD128.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
__DWORD128::__DWORD128()
{
srand((unsigned)::GetTickCount());
char *y;// = new char[16];
y = (char *)a;
for(int i = 0;i < 16;i++)
{
y[i] = (char)(0x41+rand()%0xAF);
}
}
__DWORD128::__DWORD(DWORD x, DWORD y, DWORD z, DWORD w)
{
a[0] = x;
a[1] = y;
a[2] = z;
a[3] = w;
}
__DWORD128::__DWORD(DWORD *x)
{
a[0] = x[0];
a[1] = x[1];
a[2] = x[2];
a[3] = x[3];
}
__DWORD128::~__DWORD128()
{
}
void __DWORD128::DigitalID()//把自己變成數(shù)字標(biāo)識(shí),他是一個(gè)固定的數(shù)
{
a[0] = 0x01234567;
a[1] = 0x89abcdef;
a[2] = 0xfedcba98;
a[3] = 0x76543210;
}
long __DWORD128::IsDigitalID()
{
if(a[0] != 0x01234567)
{
return 0;
}
if(a[1] != 0x89abcdef)
{
return 0;
}
if(a[2] != 0xfedcba98)
{
return 0;
}
if(a[3] != 0x76543210)
{
return 0;
}
return 1;
}
void __DWORD128::RandCount() //把自己變成一個(gè)隨機(jī)數(shù)
{
srand((unsigned)::GetTickCount());
char *y;// = new char[16];
y = (char *)a;
for(int i = 0;i < 16;i++)
{
y[i] = (char)(0x41+rand()%0xAF);
}
}
void __DWORD128::Nil() //把自己變成零
{
a[0] = 0X00000000;
a[1] = 0X00000000;
a[2] = 0X00000000;
a[3] = 0X00000000;
}
void __DWORD128::Load(DWORD *x)//把DWORD數(shù)組賦值個(gè)__DWORD128類(lèi)型
{
a[0] = x[0];
a[1] = x[1];
a[2] = x[2];
a[3] = x[3];
}
void __DWORD128::Store(DWORD *x)//把__DWORD128類(lèi)型賦值個(gè)DWORD數(shù)組
{
x[0] = a[0];
x[1] = a[1];
x[2] = a[2];
x[3] = a[3];
}
void __DWORD128::operator =(__DWORD128 &x)
{
a[0] = x.a[0];
a[1] = x.a[1];
a[2] = x.a[2];
a[3] = x.a[3];
}
void __DWORD128::operator %(__DWORD128 &x)
{
__DWORD128 z;
z = x;
x = *this;
*this = z;
}
long __DWORD128::operator ==(__DWORD128 &x)
{
if(a[3] != x.a[3]) return FALSE;
if(a[2] != x.a[2]) return FALSE;
if(a[1] != x.a[1]) return FALSE;
if(a[0] != x.a[0]) return FALSE;
return TRUE;
}
long __DWORD128::operator <(__DWORD128 &x)
{
if(x.a[3] < a[3]) return FALSE;
if(x.a[2] < a[2]) return FALSE;
if(x.a[1] < a[1]) return FALSE;
if(x.a[0] <= a[0]) return FALSE;
return TRUE;
}
long __DWORD128::operator >(__DWORD128 &x)
{
if(x.a[3] > a[3]) return TRUE;
if(x.a[2] > a[2]) return TRUE;
if(x.a[1] > a[1]) return TRUE;
if(x.a[0] > a[0]) return TRUE;
return FALSE;
}
__DWORD128 addition; //為什么addition不能在operator ^里定義呢?因?yàn)樵诜祷剡@個(gè)局部變量前會(huì)被注銷(xiāo)
__DWORD128& __DWORD128::operator ^(__DWORD128 &x)
{
addition.a[0] = x.a[0] ^ a[0];
addition.a[1] = x.a[1] ^ a[1];
addition.a[2] = x.a[2] ^ a[2];
addition.a[3] = x.a[3] ^ a[3];
return addition;
}
__DWORD128 addition2;
__DWORD128& __DWORD128::operator +(__DWORD128 &x)
{
addition2.a[0] = x.a[0] + a[0];
addition2.a[1] = x.a[1] + a[1];
addition2.a[2] = x.a[2] + a[2];
addition2.a[3] = x.a[3] + a[3];
return addition2;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -