Group value2key
Value-to-Key functions to avoid using custom comparators .More...
Public Functions
| Type | Name |
|---|---|
| LIBMDBX_API uint64_t | mdbx_key_from_double (const double ieee754_64bit) Make a 8-byte key from a double IEEE754 value. |
| LIBMDBX_API uint32_t | mdbx_key_from_float (const float ieee754_32bit) Make a 4-byte key from a float IEEE754 value. |
| uint32_t | mdbx_key_from_int32 (const int32_t i32) Make a 4-byte key from a signed int32_t value. |
| uint64_t | mdbx_key_from_int64 (const int64_t i64) Make a 8-byte key from a signed int64_t value. |
| LIBMDBX_API uint64_t | mdbx_key_from_jsonInteger (const int64_t json_integer) Make a 8-byte key from a signed int64_t JSON-number value. |
| LIBMDBX_API uint64_t | mdbx_key_from_ptrdouble (const double *const ieee754_64bit) Make a 8-byte key from a double IEEE754 value by a pointer. |
| LIBMDBX_API uint32_t | mdbx_key_from_ptrfloat (const float *const ieee754_32bit) Make a 4-byte key from a float IEEE754 value by a pointer. |
Detailed Description
See also: Key-to-Value functions
The mdbx_key_from_jsonInteger() build a keys which are comparable with keys created by mdbx_key_from_double(). So this allows mixing int64_t and IEEE754 double values in one index for JSON-numbers with restriction for integer numbers range corresponding to RFC-7159, i.e. ([-2^{53}+1,
2^{53}-1]). See bottom of page 6 at https://tools.ietf.org/html/rfc7159
Public Functions Documentation
function mdbx_key_from_double
Make a 8-byte key from a double IEEE754 value.
LIBMDBX_API uint64_t mdbx_key_from_double (
const double ieee754_64bit
)
Parameters:
ieee754_64bitThe value to be converted.
Returns:
The 8-byte key that is comparable with other keys made from double values, i.e. the order of keys is the same as the order of the original values.
function mdbx_key_from_float
Make a 4-byte key from a float IEEE754 value.
LIBMDBX_API uint32_t mdbx_key_from_float (
const float ieee754_32bit
)
Parameters:
ieee754_32bitThe value to be converted.
Returns:
The 4-byte key that is comparable with other keys made from float values, i.e. the order of keys is the same as the order of the original values.
function mdbx_key_from_int32
Make a 4-byte key from a signed int32_t value.
inline uint32_t mdbx_key_from_int32 (
const int32_t i32
)
Parameters:
i32The value to be converted.
Returns:
The 4-byte key that is comparable with other keys made from int32_t values, i.e. the order of keys is the same as the order of the original values.
function mdbx_key_from_int64
Make a 8-byte key from a signed int64_t value.
inline uint64_t mdbx_key_from_int64 (
const int64_t i64
)
Parameters:
i64The value to be converted.
Returns:
The 8-byte key that is comparable with other keys made from int64_t values, i.e. the order of keys is the same as the order of the original values.
function mdbx_key_from_jsonInteger
Make a 8-byte key from a signed int64_t JSON-number value.
LIBMDBX_API uint64_t mdbx_key_from_jsonInteger (
const int64_t json_integer
)
The resulting keys are comparable with keys created by mdbx_key_from_double(), so this allows mixing int64_t and IEEE754 double values in one index for JSON-numbers.
Parameters:
json_integerThe value to be converted.
Returns:
The 8-byte key that is comparable with keys made from double values, i.e. the order of keys is the same as the order of the original values.
function mdbx_key_from_ptrdouble
Make a 8-byte key from a double IEEE754 value by a pointer.
LIBMDBX_API uint64_t mdbx_key_from_ptrdouble (
const double *const ieee754_64bit
)
Parameters:
ieee754_64bitThe address of the value to be converted.
Returns:
The 8-byte key that is comparable with other keys made from double values.
function mdbx_key_from_ptrfloat
Make a 4-byte key from a float IEEE754 value by a pointer.
LIBMDBX_API uint32_t mdbx_key_from_ptrfloat (
const float *const ieee754_32bit
)
Parameters:
ieee754_32bitThe address of the value to be converted.
Returns:
The 4-byte key that is comparable with other keys made from float values.