2020-01-05 03:58:42 +01:00
|
|
|
use crate::common::*;
|
|
|
|
|
|
|
|
// Systems with pointers larger than 64 bits may eventually exist, but
|
2020-04-28 02:03:58 +02:00
|
|
|
// for now let's assume that usize is at most 64 bits, and document that
|
2020-01-05 03:58:42 +01:00
|
|
|
// assumption with this assert.
|
|
|
|
const_assert!(std::mem::size_of::<usize>() <= std::mem::size_of::<u64>());
|
|
|
|
|
|
|
|
pub(crate) trait IntoU64 {
|
|
|
|
fn into_u64(self) -> u64;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl IntoU64 for usize {
|
|
|
|
fn into_u64(self) -> u64 {
|
2020-01-31 10:54:46 +01:00
|
|
|
#![allow(clippy::as_conversions)]
|
2020-01-05 03:58:42 +01:00
|
|
|
self as u64
|
|
|
|
}
|
|
|
|
}
|