Function lancelot::util::u64_i64

source ·
pub fn u64_i64(i: u64) -> i64
Expand description

Static cast the given 64-bit unsigned integer to a 64-bit signed integer. This is probably only useful when some other code provides you a u64 that is meant to be an i64 (aka. uncommon).

In C: *(int64_t *)&i

Examples

use lancelot::util::*;
assert_eq!(0, u64_i64(0));
assert_eq!(1, u64_i64(0x1));
assert_eq!(-1, u64_i64(0xFFFF_FFFF_FFFF_FFFF));