vcfulong64.h

来自「这是VCF框架的代码」· C头文件 代码 · 共 1,156 行 · 第 1/2 页

H
1,156
字号
public:#	if defined(_MSC_VER) || defined(__BORLANDC__)		typedef __int64 int64_t;#	else		typedef long long int64_t;#	endif	long64() :data_(0){	}		long64(int64_t val) :data_(val){	}	long64( unsigned long val ) :data_(val){	}	long64( unsigned int val ) :data_(val){	}	long64( unsigned short val ) :data_(val){	}	long64( unsigned char val ) :data_(val){	}	long64( long val ) :data_((unsigned long)val){	}	long64( int val ) :data_((unsigned long)val){	}	long64( short val ) :data_((unsigned long)val){	}	long64( char val ) :data_((unsigned long)val){	}	long64( const long64& rhs ) :data_(rhs.data_){	}	long64( ulong32 valLow, ulong32 valHigh ){		int64_t tmp = valHigh;		tmp = tmp << 32;		data_ = tmp | (valLow & 0xffffffff);	}	long64& operator=( const long64& rhs ) {		data_ = rhs.data_;		return *this;	}		long64& operator=( const int64_t& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const long& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const int& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const short& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const char& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const unsigned long& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const unsigned int& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const unsigned short& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const unsigned char& rhs ) {		data_ = rhs;		return *this;	}	long64& operator=( const double& rhs ) {		data_ = (long)rhs;		return *this;	}	long64& operator=( const float& rhs ) {		data_ = (long)rhs;		return *this;	}	long64& operator++() {		data_ ++;		return *this;	}	long64& operator--() {		data_ --;		return *this;	}	long64 operator+( const long64& rhs ) const {		long64 result(*this);		result.data_ += rhs.data_;		return result;	}	long64 operator+( const unsigned long& rhs ) const{		long64 result(*this);		result.data_ += rhs;		return result;	}	long64 operator+( const long& rhs ) const {		long64 result(*this);		result.data_ += rhs;		return result;	}	long64 operator+( const int& rhs ) const{		long64 result(*this);		result.data_ += rhs;		return result;	}	long64& operator+=( const unsigned long& rhs ) {		data_ += rhs;		return *this;	}	long64& operator+=( const long64& rhs ) {		data_ += rhs.data_;		return *this;	}	long64 operator*( const long64& rhs ) const {		long64 result(*this);		result.data_ *= rhs.data_;		return result;	}	long64 operator*( const unsigned long& rhs ) const{		long64 result(*this);		result.data_ *= rhs;		return result;	}	long64 operator*( const long& rhs ) const{		long64 result(*this);		result.data_ *= rhs;		return result;	}	long64 operator*( const int& rhs ) const{		long64 result(*this);		result.data_ *= rhs;		return result;	}	long64& operator*=( const int& rhs ) {		data_ *= rhs;		return *this;	}	long64& operator*=( const unsigned long& rhs ) {		data_ *= rhs;		return *this;	}	long64& operator*=( const long64& rhs ) {		data_ *= rhs.data_;		return *this;	}	long64 operator/( const long64& rhs ) const{		long64 result(*this);		result.data_ /= rhs.data_;		return result;	}	long64 operator/( const unsigned long& rhs ) const{		long64 result(*this);		result.data_ /= rhs;		return result;	}	long64 operator/( const long& rhs ) const {		long64 result(*this);		result.data_ /= rhs;		return result;	}	long64 operator/( int rhs ) const {		long64 result(*this);		result.data_ /= rhs;		return result;	}	long64 operator/( const char& rhs ) const{		long64 result(*this);		result.data_ /= rhs;		return result;	}	long64& operator/=( const unsigned long& rhs ) {		data_ /= rhs;		return *this;	}	long64& operator/=( const long64& rhs ) {		data_ /= rhs.data_;		return *this;	}	long64 operator%( const long64& rhs ) const{		long64 result(*this);		result.data_ %= rhs.data_;		return result;	}	long64 operator%( const unsigned long& rhs ) const{		long64 result(*this);		result.data_ %= rhs;		return result;	}	long64 operator%( const long& rhs ) const {		long64 result(*this);		result.data_ %= rhs;		return result;	}	long64 operator%( int rhs ) const {		long64 result(*this);		result.data_ %= rhs;		return result;	}	long64 operator%( const char& rhs ) const{		long64 result(*this);		result.data_ %= rhs;		return result;	}	long64& operator%=( const unsigned long& rhs ) {		data_ %= rhs;		return *this;	}	long64& operator%=( const long64& rhs ) {		data_ %= rhs.data_;		return *this;	}	long64 operator-( const long64& rhs ) const{		long64 result(*this);		result.data_ -= rhs.data_;		return result;	}	long64 operator-( const unsigned long& rhs ) const{		long64 result(*this);		result.data_ -= rhs;		return result;	}	long64 operator-( const long& rhs ) const{		long64 result(*this);		result.data_ -= rhs;		return result;	}	long64& operator-=( const long64& rhs ) {		data_ -= rhs.data_;		return *this;	}	long64& operator-=( const unsigned long& rhs ) {		data_ -= rhs;		return *this;	}	//comparison	bool operator> (const long64& rhs ) const{		return data_ > rhs.data_;	}	bool operator< (const long64& rhs ) const{		return data_ < rhs.data_;	}	bool operator>= (const long64& rhs ) const{		return data_ >= rhs.data_;	}	bool operator<= (const long64& rhs ) const{		return data_ <= rhs.data_;	}	bool operator!= (const long64& rhs ) const{		return data_ != rhs.data_;	}	bool operator== (const long64& rhs ) const{		return data_ == rhs.data_;	}	//converstion routines	operator char() const {		return (char)data_;	}	operator unsigned char() const {		return (unsigned char)data_;	}	operator short() const {		return (short)data_;	}	operator unsigned short() const {		return (unsigned short)data_;	}	operator long() const {		return (long)data_;	}	operator unsigned long() const {		return (unsigned long)data_;	}	operator int() const {		return (int)data_;	}	operator unsigned int() const {		return (unsigned int)data_;	}	operator double() const {		return (double)(int64_t)data_;//(signed __int64)data_;	}	operator int64_t() const {		return (int64_t)data_;//(signed __int64)data_;	}		/**	This returns the top 32 bits of the number	*/	unsigned long hi() const {		unsigned long result = 0;		result = data_ >> 32;		return result;	}	/**	This returns the low 32 bits of the number	*/	unsigned long lo() const {		unsigned long result = 0;		result = data_ & 0xffffffff;		return result;	}	/**	This sets the top 32 bits of the number	*/	void hi( unsigned long val ) {		int64_t tmp = val;		tmp = tmp << 32;		data_ = tmp | (data_ & 0xffffffff);	}	/**	This sets the low 32 bits of the number	*/	void lo( unsigned long val ) {		/**		kind of hacky but GCC won't let me do this		data_ = val | (data_ & 0xffffffff00000000);		since it complains about a constant value being too big.		Cie la vie! :)		*/		int64_t tmp = data_ >> 32;		data_ = (tmp << 32) | val;	}	int64_t data_;};};// end of namespace/***CVS Log info*$Log$*Revision 1.6  2006/04/07 02:35:36  ddiego*initial checkin of merge from 0.6.9 dev branch.**Revision 1.5.2.1  2006/03/12 22:01:44  ddiego*doc updates.**Revision 1.5  2005/07/18 03:54:19  ddiego*documentation updates.**Revision 1.4  2005/07/09 23:15:06  ddiego*merging in changes from devmain-0-6-7 branch.**Revision 1.3.2.1  2005/02/16 05:09:33  ddiego*bunch o bug fixes and enhancements to the property editor and treelist control.**Revision 1.3  2004/12/01 04:31:42  ddiego*merged over devmain-0-6-6 code. Marcello did a kick ass job*of fixing a nasty bug (1074768VCF application slows down modal dialogs.)*that he found. Many, many thanks for this Marcello.**Revision 1.2.2.1  2004/08/23 21:12:35  marcelloptr*added *=, /= and %= operators to lon64 and ulong64 classes**Revision 1.2  2004/08/07 02:49:15  ddiego*merged in the devmain-0-6-5 branch to stable**Revision 1.1.2.8  2004/07/31 12:22:52  kiklop74*Minor tweak in long64 class needed to properly define type for bcc**Revision 1.1.2.7  2004/07/30 17:28:40  kiklop74*Added first release of Borland midifications for VCF**Revision 1.1.2.6  2004/07/24 01:40:42  ddiego*committed changes requested by Marcello. Got rid of the remaining*date time members on the File class - now the dat time function call the*FilePeer directly each time. Also added 2 functions to DateTime to convert*directly to UTC or Local time.**Revision 1.1.2.5  2004/07/05 01:01:55  marcelloptr*added ulong64 ctor, operators and toString conversion**Revision 1.1.2.4  2004/06/16 15:40:47  marcelloptr*just some comments**Revision 1.1.2.3  2004/06/06 07:05:33  marcelloptr*changed macros, text reformatting, copyright sections**Revision 1.1.2.2  2004/04/29 04:07:13  marcelloptr*reformatting of source files: macros and csvlog and copyright sections**/#endif // _VCF_VCFULONG64_H__

⌨️ 快捷键说明

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