We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd94201 commit 0152915Copy full SHA for 0152915
src/utils/src/lib.rs
@@ -41,6 +41,15 @@ pub const fn u64_to_usize(num: u64) -> usize {
41
num as usize
42
}
43
44
+/// Safely converts a usize value to a u64 value.
45
+/// This bypasses the Clippy lint check because we only support 64-bit platforms.
46
+#[cfg(target_pointer_width = "64")]
47
+#[inline]
48
+#[allow(clippy::cast_possible_truncation)]
49
+pub const fn usize_to_u64(num: usize) -> u64 {
50
+ num as u64
51
+}
52
+
53
/// Converts a usize into a wrapping u32.
54
#[inline]
55
pub const fn wrap_usize_to_u32(num: usize) -> Wrapping<u32> {
0 commit comments