Digi XBee(R) ANSI C Host Library
Macros | Typedefs

Macros for working with 64-bit integers via the zcl64_t datatype. More...

#include "xbee/platform.h"

Go to the source code of this file.

Macros

#define ZCL64_INIT(hi, lo)   JSLL_INIT(hi, lo)
 Initialize a zcl64_t variable with two literal 32-bit values. More...
 
#define ZCL64_LOAD(r, hi32, lo32)   ((r).hi = (hi32), (r).lo = (lo32))
 Load a zcl64_t variable with two 32-bit values (high and low). More...
 
#define ZCL64_IS_ZERO(a)   JSLL_IS_ZERO(a)
 Compare a zcl64_t variable to zero. More...
 
#define ZCL64_EQ(a, b)   JSLL_EQ(a, b)
 Compare two zcl64_t variables for equality. More...
 
#define ZCL64_NE(a, b)   JSLL_NE(a, b)
 Compare two zcl64_t variables for inequality. More...
 
#define ZCL64_GE_ZERO(a)   JSLL_GE_ZERO(a)
 Compare a signed zcl64_t variable to 0. More...
 
#define ZCL64_LT(a, b)   JSLL_REAL_CMP(a, <, b)
 Compare two zcl64_t variables (signed less-than comparison) More...
 
#define ZCL64_LTU(a, b)   JSLL_REAL_UCMP(a, <, b)
 Compare two zcl64_t variables (unsigned less-than comparison) More...
 
#define ZCL64_AND(r, a, b)   JSLL_AND(r, a, b)
 Perform a bitwise AND of two zcl64_t variables. More...
 
#define ZCL64_OR(r, a, b)   JSLL_OR(r, a, b)
 Perform a bitwise OR of two zcl64_t variables. More...
 
#define ZCL64_XOR(r, a, b)   JSLL_XOR(r, a, b)
 Perform a bitwise XOR of two zcl64_t variables. More...
 
#define ZCL64_NOT(r, a)   JSLL_NOT(r, a)
 Perform a bitwise NOT of a zcl64_t variable. More...
 
#define ZCL64_NEG(r, a)   JSLL_NEG(r, a)
 Negate a zcl64_t variable. More...
 
#define ZCL64_ADD(r, a, b)   JSLL_ADD(r, a, b)
 Add two zcl64_t variables. More...
 
#define ZCL64_SUB(r, a, b)   JSLL_SUB(r, a, b)
 Subtract two zcl64_t variables. More...
 
#define ZCL64_MUL(r, a, b)   JSLL_MUL(r, a, b)
 Multiply two zcl64_t variables. More...
 
#define ZCL64_MUL32(r, a, b)   JSLL_MUL32(r, a, b)
 Multiply two 32-bit variables (int32_t or uint32_t) and store the result in a zcl64_t variable. More...
 
#define ZCL64_UDIVMOD(qp, rp, a, b)   JSLL_UDIVMOD(qp, rp, a, b)
 Divide an unsigned zcl64_t variable by another unsigned zcl64_t variable and store the 64-bit quotient and remainder. More...
 
#define ZCL64_DIV(r, a, b)   JSLL_DIV(r, a, b)
 Perform signed division of two zcl64_t variables and store the quotient. More...
 
#define ZCL64_MOD(r, a, b)   JSLL_MOD(r, a, b)
 Perform signed division of two zcl64_t variables and store the remainder. More...
 
#define ZCL64_ASL(r, a, b)   JSLL_SHL(r, a, b)
 Arithmetic Shift Left of a zcl64_t variable. More...
 
#define ZCL64_LSL(r, a, b)   ZCL64_SLA(r, a, b)
 Logical Shift Left of a zcl64_t variable. More...
 
#define ZCL64_ASR(r, a, b)   JSLL_SHR(r, a, b)
 Arithmetic Shift Right of a signed zcl64_t variable. More...
 
#define ZCL64_LSR(r, a, b)   JSLL_USHR(r, a, b)
 Logical Shift Right of an unsigned zcl64_t variable. More...
 
#define ZCL64_TO_INT32(i32, i64)   JSLL_L2I(i32, i64)
 Cast a signed zcl64_t variable down to a signed 32-bit integer. More...
 
#define ZCL64_TO_UINT32(u32, u64)   JSLL_L2UI(u32, u64)
 Cast an unsigned zcl64_t variable down to an unsigned 32-bit integer. More...
 
#define ZCL64_LOW32(u64)   ((u64).lo)
 The lower-32 bits of a ZCL64 value. More...
 
#define ZCL64_HIGH32(u64)   ((u64).hi)
 The upper-32 bits of a ZCL64 value. More...
 
#define ZCL64_TO_FLOAT(f, i64)   JSLL_L2F(f, i64)
 Cast a signed zcl64_t variable to a float. More...
 
#define ZCL64_TO_DOUBLE(d, i64)   JSLL_L2D(d, i64)
 Cast a signed zcl64_t variable to a double. More...
 
#define ZCL64_FROM_INT32(i64, i32)   JSLL_I2L(i64, i32)
 Cast a signed 32-bit integer up to a zcl64_t variable. More...
 
#define ZCL64_FROM_UINT32(u64, u32)   JSLL_UI2L(u64, u32)
 Cast an unsigned 32-bit integer up to a zcl64_t variable. More...
 
#define ZCL64_FROM_FLOAT(i64, f)   JSLL_F2L(i64, f)
 Cast a double into a signed zcl64_t variable. More...
 
#define ZCL64_FROM_DOUBLE(i64, d)   JSLL_D2L(i64, d)
 Cast a float into a signed zcl64_t variable. More...
 
#define ZCL64_TO_HEXSTR(buffer, var)   JSLL_HEXSTR(buffer, var)
 Convert a zcl64_t variable to a 16-character printable hexadecimal string. More...
 
#define ZCL64_TO_DECSTR(buffer, var)   JSLL_DECSTR(buffer, var)
 Convert a signed zcl64_t variable to a 20-character printable decimal string. More...
 
#define ZCL64_TO_UDECSTR(buffer, var)   JSLL_UDECSTR(buffer, var)
 Convert an unsigned zcl64_t variable to a 20-character printable decimal string. More...
 

Typedefs

typedef JSUint64 zcl64_t
 64-bit integer in host-byte-order Use for 56-bit values as well – ZCL layer will make sure top byte is sign-extended. More...
 

Detailed Description

Macros for working with 64-bit integers via the zcl64_t datatype.

Makes use of the JSInt64 type and support functions included in the platform support code (jslong.h, jslong.c).

On some platforms (Win32), zcl64_t is simply a uint64_t. Most embedded platforms represent a zcl64_t value as a structure. Because of that difference, you can't just write "c = a + b" or "a.lo = ~a.lo, a.hi = ~a.hi" – neither statement is portable to the other platform type.

Therefore, it is necessary to use the macro functions in this file to manipulate zcl64_t variables.

Todo:
add a ZCL64_SPLIT macro to split zcl64_t into high and low halves