NSPR Reference Previous Contents Next |
Most of the 64-bit integer operations are implemented as macros. The specific
implementation of each macro depends on whether the compiler for the target
platform supports 64-bit integers. For a specific target platform, if 64-bit integers
are supported for that platform, define HAVE_LONG_LONG
at compile time.
PRInt64
and PRUint64
.
Limits and Initialization
Relational Operators
Logical Operators
Arithmetic Operators
Shift Operators
Conversion Operators
LL_MaxInt
LL_MinInt
LL_Zero
LL_INIT
#include <prlong.h>
PRInt64 LL_MaxInt( void );
#include <prlong.h>
PRInt64 LL_MinInt( void );
PRInt64
value of zero.
#include <prlong.h>
PRInt64 LL_Zero( void );
PRInt64
value of zero
#include <prlong.h>
PRInt64 LL_INIT(
PRInt32 hi,
PRInt32 lo );
hi
|
The most significant 32-bit part of the 64-bit integer.
|
lo
|
The least significant 32-bit part of the 64-bit integer.
|
PRInt64
variables predefined by the caller. The return value is platform
dependent. It should be treated as an int
. Make no other assumptions about its
value.
LL_IS_ZERO
LL_EQ
LL_NE
LL_GE_ZERO
LL_CMP
LL_UCMP
#include <prlong.h>
int LL_IS_ZERO ( PRInt64 a );
a
|
A 64-bit integer to be evaluated for zero.
|
a
is equal to zero; zero when a
is not equal to zero.
#include <prlong.h>
int LL_EQ(
PRInt64 a,
PRInt64 b);
a
|
First comparand.
|
b
|
Second comparand.
|
a
is equal to b
, otherwise zero.
#include <prlong.h>
int LL_NE(
PRInt64 a,
PRInt64 b);
a
|
First comparand.
|
b
|
Second comparand.
|
a
is not equal to b
, otherwise zero.
#include <prlong.h>
int LL_GE_ZERO( PRInt64 a );
a
|
A 64-bit integer to be evaluated .
|
a
is greater than or equal to zero, otherwise zero.
#include <prlong.h>
int LL_CMP(
PRInt64 a,
operator,
PRInt64 b);
a
|
First comparand.
|
operator
|
A valid C comparison operator.
|
b
|
Second comparand.
|
a
compared to b
using operator
is true, otherwise zero.
PRInt64 foo = LL_INIT( 0, 1 );
PRInt64 bar = LL_INIT( 0, 2 );
if ( LL_CMP( foo, <, bar ))
DoIt(); /* This gets called */
#include <prlong.h>
LL_UCMP(
PRUint64 a,
operator,
PRUint64 b);
a
|
First comparand
|
operator
|
A comparison operator.
|
b
|
Second comparand
|
a
compared to b
using operator
is true, otherwise zero.
PRUint64 foo = LL_INIT( -1, 1 );
PRUint64 bar = LL_INIT( 0, 2 );
if ( LL_UCMP( foo, =, bar ))
DoIt(); /* This gets called */
PRInt64
variables predefined by the caller. For each operator, a result parameter
contains the result of the operation upon return from the macro.
LL_AND
LL_OR
LL_XOR
LL_OR2
LL_NOT
#include <prlong.h>
void LL_AND (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
The result value
|
a
|
First operand.
|
b
|
Second operand.
|
a
and b
. The result is
bound to the variable r
.
include <prlong.h>
void LL_OR (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
A variable that will contain the result value.
|
a
|
First operand.
|
b
|
Second operand.
|
a
and b
. The result is
bound to the variable r
.
#include <prlong.h>
void LL_XOR (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
A variable that will contain the result value.
|
a
|
First operand.
|
b
|
Second operand.
|
a
and b
. The result is
bound to the variable r
.
#include <prlong.h>
void LL_OR2 (
PRInt64 r,
PRInt64 a);
r
|
The first operand and result value.
|
a
|
The second operand.
|
r
and a
. The result is
bound to the variable r
.
#include <prlong.h>
void LL_NOT (
PRInt64 r,
PRInt64 a);
r
|
A variable that will contain the result value.
|
a
|
The operand.
|
a
, inverting all of
the bits. The result is bound to the variable r
.
PRInt64
variables predefined by the caller. For each operator, a result parameter
contains the result of the operation upon return from the macro.
LL_NEG
LL_ADD
LL_SUB
LL_MUL
LL_DIV
LL_MOD
LL_UDIVMOD
#include <prlong.h>
void LL_NEG (
PRInt64 r,
PRInt64 a);
r
|
A variable that will contain the result value.
|
a
|
Operand to be negated
|
a
. The result is bound to the variable r
.
#include <prlong.h>
void LL_ADD (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
A variable that will contain the result value.
|
a
|
First operand.
|
b
|
Second operand.
|
a
and b
. The result is bound to the
variable r
.
#include <prlong.h>
void LL_SUB (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
A variable that will contain the result value.
|
a
|
First operand.
|
b
|
Second operand.
|
b
from operand a.
The result is bound to the
variable r
.
#include <prlong.h>
void LL_MUL (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
A variable that will contain the result value.
|
a
|
First operand.
|
b
|
Second operand.
|
a
and operand b
. The result is bound to the variable
r
.
#include <prlong.h>
void LL_DIV (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
A variable that will contain the result value.
|
a
|
First operand.
|
b
|
Second operand.
|
a
by operand b
. The integer result is bound to the
variable r
.
#include <prlong.h>
void LL_MOD (
PRInt64 r,
PRInt64 a,
PRInt64 b);
r
|
A variable that will contain the result value.
|
a
|
The dividend.
|
b
|
The divisor.
|
a
by operand b
. The remainder is bound to the
variable r
.
#include <prlong.h>
void LL_UDIVMOD(
PRUint64 *qp,
PRUint64 *rp,
PRUint64 a,
PRUint64 b);
qp
|
A pointer to the quotient.
|
rp
|
A pointer to the remainder.
|
a
|
The dividend.
|
b
|
The divisor.
|
a
by operand b
,. The unsigned 64-bit integer result
quotient is stored at the location specified by qp
. The unsigned 64-bit integer result
remainder is stored at the location specified by rp
.
#include <prlong.h>
void LL_SHL (
PRInt64 r,
PRInt64 a,
PRInt32 b);
r
|
A variable that will contain the result value.
|
a
|
The operand.
|
b
|
The number of bits by which to shift the operand.
|
a
left by the number of bits specified
in b
. The result is bound to the variable r
.
#include <prlong.h>
void LL_SHL (
PRInt64 r,
PRInt64 a,
PRInt32 b);
r
|
A variable that will contain the result value.
|
a
|
The operand.
|
b
|
The number of bits by which to shift the operand.
|
a
right by the number of bits specified
in b
. The result is bound to the variable r
.
#include <prlong.h>
void LL_USHR (
PRInt64 r,
PRInt64 a,
PRInt32 b);
r
|
A variable that will contain the result value.
|
a
|
The operand.
|
b
|
The number of bits by which to shift the operand.
|
a
right by the number of bits specified in b
.
The result is bound to the variable r
.
#include <prlong.h>
LL_USHL(
PRInt64 r,
PRInt64 a,
PRInt32 b);
r
|
A variable that will contain the result value.
|
a
|
The operand.
|
b
|
The number of bits by which to shift the operand.
|
a
left by the number of bits specified in b
.
The result is bound to the variable r
.
LL_L2I
LL_L2UI
LL_L2F
LL_L2D
LL_I2L
LL_UI2L
LL_F2L
LL_D2L
#include <prlong.h>
void LL_L2I (
PRInt32 i,
PRInt64 l);
i
|
The 32-bit integer result.
|
l
|
The 64-bit integer to be converted.
|
l
to the 32-bit integer i
.
#include <prlong.h>
void LL_L2UI (
PRUint32 i,
PRInt64 l);
i
|
The unsigned 32-bit integer result.
|
l
|
The 64-bit integer to be converted.
|
#include <prlong.h>
void LL_L2F (
PRFloat32 f,
PRInt64 l);
f
|
The floating point result.
|
l
|
The 64-bit integer to be converted.
|
l
to the floating point number f
.
#include <prlong.h>
void LL_L2D (
PRFloat64 d,
PRInt64 l);
d
|
The double floating point result.
|
l
|
The 64-bit integer to be converted.
|
l
to the double floating point number d
.
#include <prlong.h>
void LL_I2L (
PRInt64 l,
PRInt32 i);
l
|
The 64-bit integer result.
|
i
|
The 32-bit integer to be converted.
|
i
to the 64-bit integer l
.
#include <prlong.h>
void LL_UI2L (
PRInt64 l,
PRUint32 i);
l
|
The 64-bit result.
|
i
|
The unsigned 32-bit integer to be converted.
|
i
to the 64-bit integer l
.
#include <prlong.h>
void LL_F2L (
PRInt64 l,
float f);
l
|
The 64-bit integer result.
|
f
|
The floating point number to be converted.
|
f
to the 64-bit integer l
.
#include <prlong.h>
void LL_D2L (
PRInt64 l,
PRFloat64 d);
l
|
The 64-bit integer result.
|
d
|
The double floating point number to be converted.
|
d
to the 64-bit integer l
.
Last Updated May 18, 2001