contents up previous next

wxlonglong

this class represents a signed 64 bit long number. it is implemented using the native 64 bit type where available (machines with 64 bit longs or compilers which have (an analog of) long long type) and uses the emulation code in the other cases which ensures that it is the most efficient solution for working with 64 bit integers independently of the architecture.

wxlonglong defines all usual arithmetic operations such as addition, subtraction, bitwise shifts and logical operations as well as multiplication and division (not yet for the machines without native long long). it also has operators for implicit construction from and conversion to the native long long type if it exists and long.

you would usually use this type in exactly the same manner as any other (built-in) arithmetic type. note that wxlonglong is a signed type, if you want unsigned values use wxulonglong which has exactly the same api as wxlonglong except when explicitly mentioned otherwise.

if a native (i.e. supported directly by the compiler) 64 bit integer type was found to exist, wxlonglong_t macro will be defined to correspond to it. also, in this case only, two additional macros will be defined: wxlonglongfmtspec for printing 64 bit integers using the standard printf() function (but see also tostring() for a more portable solution) and wxll for defining 64 bit integer compile-time constants.

derived from

no base class

include files

<wx/longlong.h>

members

wxlonglong::wxlonglong
wxlonglong::wxlonglong
wxlonglong::wxlonglong
wxlonglong::operator=
wxlonglong::operator=
wxlonglong::operator=
wxlonglong::operator=
wxlonglong::operator=
wxlonglong::abs
wxlonglong::assign
wxlonglong::gethi
wxlonglong::getlo
wxlonglong::getvalue
wxlonglong::todouble
wxlonglong::tolong
wxlonglong::tostring
wxlonglong::operator+
wxlonglong::operator+=
wxlonglong::operator++
wxlonglong::operator-
wxlonglong::operator-
wxlonglong::operator-=
wxlonglong::operator--


wxlonglong::wxlonglong

wxlonglong()

default constructor initializes the object to 0.


wxlonglong::wxlonglong

wxlonglong(wxlonglong_t ll)

constructor from native long long (only for compilers supporting it).


wxlonglong::wxlonglong

wxlonglong(long hi, unsigned long lo)

constructor from 2 longs: the high and low part are combined into one wxlonglong.


wxlonglong::operator=

wxlonglong& operator operator=(wxlonglong_t ll)

assignment operator from native long long (only for compilers supporting it).


wxlonglong::operator=

wxlonglong& operator operator=(wxulonglong_t ll)

assignment operator from native unsigned long long (only for compilers supporting it).

this function is new since wxwidgets version 2.7.0


wxlonglong::operator=

wxlonglong& operator operator=(long l)

assignment operator from long.

this function is new since wxwidgets version 2.7.0


wxlonglong::operator=

wxlonglong& operator operator=(unsigned long l)

assignment operator from unsigned long.

this function is new since wxwidgets version 2.7.0


wxlonglong::operator=

wxlonglong& operator operator=(const wxulonglong & ll)

assignment operator from unsigned long long. the sign bit will be copied too.

this function is new since wxwidgets version 2.7.0


wxlonglong::abs

wxlonglong abs() const

wxlonglong& abs()

returns an absolute value of wxlonglong - either making a copy (const version) or modifying it in place (the second one). not in wxulonglong.


wxlonglong::assign

wxlonglong& assign(double d)

this allows to convert a double value to wxlonglong type. such conversion is not always possible in which case the result will be silently truncated in a platform-dependent way. not in wxulonglong.


wxlonglong::gethi

long gethi() const

returns the high 32 bits of 64 bit integer.


wxlonglong::getlo

unsigned long getlo() const

returns the low 32 bits of 64 bit integer.


wxlonglong::getvalue

wxlonglong_t getvalue() const

convert to native long long (only for compilers supporting it)


wxlonglong::todouble

double todouble() const

returns the value as double.


wxlonglong::tolong

long tolong() const

truncate wxlonglong to long. if the conversion loses data (i.e. the wxlonglong value is outside the range of built-in long type), an assert will be triggered in debug mode.


wxlonglong::tostring

wxstring tostring() const

returns the string representation of a wxlonglong.


wxlonglong::operator+

wxlonglong operator+(const wxlonglong& ll) const

adds 2 wxlonglongs together and returns the result.


wxlonglong::operator+=

wxlonglong& operator+(const wxlonglong& ll)

add another wxlonglong to this one.


wxlonglong::operator++

wxlonglong& operator++()

wxlonglong& operator++(int)

pre/post increment operator.


wxlonglong::operator-

wxlonglong operator-() const

returns the value of this wxlonglong with opposite sign. not in wxulonglong.


wxlonglong::operator-

wxlonglong operator-(const wxlonglong& ll) const

subtracts 2 wxlonglongs and returns the result.


wxlonglong::operator-=

wxlonglong& operator-(const wxlonglong& ll)

subtracts another wxlonglong from this one.


wxlonglong::operator--

wxlonglong& operator--()

wxlonglong& operator--(int)

pre/post decrement operator.