Digi XBee(R) ANSI C Host Library
|
Files | |
file | zcl64.h |
Macros for working with 64-bit integers via the zcl64_t datatype. | |
file | jslong.c |
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... | |
#define | jslo16(a) ((a) & 0x0000FFFF) |
#define | jshi16(a) ((uint32_t)(a) >> 16) |
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... | |
Functions | |
void | jsll_mul (JSUint64 *rp, JSUint64 a, JSUint64 b) |
void | jsll_mul32 (JSUint64 *rp, JSUint32 a, JSUint32 b) |
void | jsll_udivmod (JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint64 b) |
void | jsll_div (JSUint64 *r, const JSUint64 *a, const JSUint64 *b) |
void | jsll_mod (JSUint64 *r, const JSUint64 *a, const JSUint64 *b) |
void | jsll_shl (JSUint64 *r, JSUint64 a, uint_fast8_t b) |
void | jsll_shr (JSInt64 *r, JSInt64 a, uint_fast8_t b) |
void | jsll_ushr (JSInt64 *r, JSInt64 a, uint_fast8_t b) |
int | jsll_decstr (char *buffer, const JSInt64 *v) |
int | jsll_udecstr (char *buffer, const JSUint64 *v) |
#define ZCL64_ADD | ( | r, | |
a, | |||
b | |||
) | JSLL_ADD(r, a, b) |
Add two zcl64_t variables.
[out] | r | zcl64_t variable to assign (a + b) to |
[in] | a | zcl64_t variable |
[in] | b | zcl64_t variable |
#define ZCL64_AND | ( | r, | |
a, | |||
b | |||
) | JSLL_AND(r, a, b) |
#define ZCL64_ASL | ( | r, | |
a, | |||
b | |||
) | JSLL_SHL(r, a, b) |
#define ZCL64_ASR | ( | r, | |
a, | |||
b | |||
) | JSLL_SHR(r, a, b) |
#define ZCL64_DIV | ( | r, | |
a, | |||
b | |||
) | JSLL_DIV(r, a, b) |
Perform signed division of two zcl64_t variables and store the quotient.
[out] | r | signed zcl64_t variable to assign (a / b) to |
[in] | a | signed zcl64_t variable |
[in] | b | signed zcl64_t variable |
#define ZCL64_EQ | ( | a, | |
b | |||
) | JSLL_EQ(a, b) |
Compare two zcl64_t variables for equality.
[in] | a | zcl64_t variable |
[in] | b | zcl64_t variable |
#define ZCL64_FROM_DOUBLE | ( | i64, | |
d | |||
) | JSLL_D2L(i64, d) |
Cast a float
into a signed zcl64_t variable.
[out] | i64 | signed zcl64_t variable to cast d into |
[in] | d | double variable/value |
#define ZCL64_FROM_FLOAT | ( | i64, | |
f | |||
) | JSLL_F2L(i64, f) |
Cast a double
into a signed zcl64_t variable.
[out] | i64 | signed zcl64_t variable to cast f into |
[in] | f | float variable/value |
#define ZCL64_FROM_INT32 | ( | i64, | |
i32 | |||
) | JSLL_I2L(i64, i32) |
Cast a signed 32-bit integer up to a zcl64_t variable.
[out] | i64 | signed zcl64_t variable to cast i32 into |
[in] | i32 | int32_t variable |
#define ZCL64_FROM_UINT32 | ( | u64, | |
u32 | |||
) | JSLL_UI2L(u64, u32) |
Cast an unsigned 32-bit integer up to a zcl64_t variable.
[out] | u64 | unsigned zcl64_t variable to cast u32 into |
[in] | u32 | uint32_t variable |
#define ZCL64_GE_ZERO | ( | a | ) | JSLL_GE_ZERO(a) |
Compare a signed zcl64_t variable to 0.
[in] | a | signed zcl64_t variable |
#define ZCL64_HIGH32 | ( | u64 | ) | ((u64).hi) |
The upper-32 bits of a ZCL64 value.
[in] | u64 | unsigned zcl64_t variable |
#define ZCL64_INIT | ( | hi, | |
lo | |||
) | JSLL_INIT(hi, lo) |
Initialize a zcl64_t variable with two literal 32-bit values.
Note that this macro is only valid as an initializer in a variable declaration. Use ZCL64_LOAD in general program statements.
[in] | hi | upper 32 bits |
[in] | lo | lower 32 bits |
#define ZCL64_IS_ZERO | ( | a | ) | JSLL_IS_ZERO(a) |
Compare a zcl64_t variable to zero.
[in] | a | zcl64_t variable |
#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).
[out] | r | zcl64_t variable to assign (hi << 32 + lo) to |
[in] | hi32 | upper 32 bits to load into |
r | ||
[in] | lo32 | lower 32 bits to load into |
r |
#define ZCL64_LOW32 | ( | u64 | ) | ((u64).lo) |
The lower-32 bits of a ZCL64 value.
[in] | u64 | unsigned zcl64_t variable |
#define ZCL64_LSL | ( | r, | |
a, | |||
b | |||
) | ZCL64_SLA(r, a, b) |
#define ZCL64_LSR | ( | r, | |
a, | |||
b | |||
) | JSLL_USHR(r, a, b) |
#define ZCL64_LT | ( | a, | |
b | |||
) | JSLL_REAL_CMP(a, <, b) |
Compare two zcl64_t variables (signed less-than comparison)
[in] | a | signed zcl64_t variable |
[in] | b | signed zcl64_t variable |
#define ZCL64_LTU | ( | a, | |
b | |||
) | JSLL_REAL_UCMP(a, <, b) |
Compare two zcl64_t variables (unsigned less-than comparison)
[in] | a | unsigned zcl64_t variable |
[in] | b | unsigned zcl64_t variable |
#define ZCL64_MOD | ( | r, | |
a, | |||
b | |||
) | JSLL_MOD(r, a, b) |
Perform signed division of two zcl64_t variables and store the remainder.
[out] | r | zcl64_t variable to assign (a + b) to |
[in] | a | zcl64_t variable |
[in] | b | zcl64_t variable |
#define ZCL64_MUL | ( | r, | |
a, | |||
b | |||
) | JSLL_MUL(r, a, b) |
Multiply two zcl64_t variables.
[out] | r | zcl64_t variable to assign (a * b) to |
[in] | a | zcl64_t variable |
[in] | b | zcl64_t variable |
#define ZCL64_MUL32 | ( | r, | |
a, | |||
b | |||
) | JSLL_MUL32(r, a, b) |
#define ZCL64_NE | ( | a, | |
b | |||
) | JSLL_NE(a, b) |
Compare two zcl64_t variables for inequality.
[in] | a | zcl64_t variable |
[in] | b | zcl64_t variable |
#define ZCL64_NEG | ( | r, | |
a | |||
) | JSLL_NEG(r, a) |
#define ZCL64_NOT | ( | r, | |
a | |||
) | JSLL_NOT(r, a) |
#define ZCL64_OR | ( | r, | |
a, | |||
b | |||
) | JSLL_OR(r, a, b) |
#define ZCL64_SUB | ( | r, | |
a, | |||
b | |||
) | JSLL_SUB(r, a, b) |
Subtract two zcl64_t variables.
[out] | r | zcl64_t variable to assign (a - b) to |
[in] | a | zcl64_t variable |
[in] | b | zcl64_t variable |
#define ZCL64_TO_DECSTR | ( | buffer, | |
var | |||
) | JSLL_DECSTR(buffer, var) |
Convert a signed zcl64_t variable to a 20-character printable decimal string.
[out] | buffer | 21-character buffer to hold hexadecimal string |
[in] | var | signed zcl64_t variable to stringify |
buffer
(1 to 20), in addition to the null terminator#define ZCL64_TO_DOUBLE | ( | d, | |
i64 | |||
) | JSLL_L2D(d, i64) |
Cast a signed zcl64_t variable to a double
.
[out] | d | double variable to cast i64 into |
[in] | i64 | signed zcl64_t variable |
#define ZCL64_TO_FLOAT | ( | f, | |
i64 | |||
) | JSLL_L2F(f, i64) |
Cast a signed zcl64_t variable to a float
.
[out] | f | float variable to cast i64 into |
[in] | i64 | signed zcl64_t variable |
#define ZCL64_TO_HEXSTR | ( | buffer, | |
var | |||
) | JSLL_HEXSTR(buffer, var) |
Convert a zcl64_t variable to a 16-character printable hexadecimal string.
[out] | buffer | 17-character buffer to hold hexadecimal string |
[in] | var | zcl64_t variable to stringify |
16 | this function always returns 16, the number of characters written to buffer (in addition to the null terminator) |
#define ZCL64_TO_INT32 | ( | i32, | |
i64 | |||
) | JSLL_L2I(i32, i64) |
Cast a signed zcl64_t variable down to a signed 32-bit integer.
[out] | i32 | int32_t variable to cast i64 into |
[in] | i64 | signed zcl64_t variable |
#define ZCL64_TO_UDECSTR | ( | buffer, | |
var | |||
) | JSLL_UDECSTR(buffer, var) |
Convert an unsigned zcl64_t variable to a 20-character printable decimal string.
[out] | buffer | 21-character buffer to hold hexadecimal string |
[in] | var | unsigned zcl64_t variable to stringify |
buffer
(1 to 20), in addition to the null terminator#define ZCL64_TO_UINT32 | ( | u32, | |
u64 | |||
) | JSLL_L2UI(u32, u64) |
Cast an unsigned zcl64_t variable down to an unsigned 32-bit integer.
[out] | u32 | uint32_t variable to cast u64 into |
[in] | u64 | unsigned zcl64_t variable |
#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.
[out] | qp | NULL to ignore the quotient, or address of a zcl64_t variable to assign (a / b) to |
[out] | rp | NULL to ignore the remainder, or address of a zcl64_t variable to assign (a % b) to |
[in] | a | zcl64_t variable |
[in] | b | zcl64_t variable |
#define ZCL64_XOR | ( | r, | |
a, | |||
b | |||
) | JSLL_XOR(r, a, b) |