1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#[derive(PartialEq, Eq, core::marker::ConstParamTy)]
pub enum HostAndDeviceKernelSignatureTypeLayout {
    Match,
    Mismatch,
}

pub struct Assert<const MATCH: HostAndDeviceKernelSignatureTypeLayout>;

#[must_use]
pub const fn check(a: &[u64], b: &[u64]) -> HostAndDeviceKernelSignatureTypeLayout {
    if a.len() != b.len() {
        return HostAndDeviceKernelSignatureTypeLayout::Mismatch;
    }

    if unsafe {
        core::intrinsics::compare_bytes(
            a.as_ptr().cast(),
            b.as_ptr().cast(),
            a.len() * core::mem::size_of::<u64>(),
        ) != 0
    } {
        return HostAndDeviceKernelSignatureTypeLayout::Mismatch;
    }

    HostAndDeviceKernelSignatureTypeLayout::Match
}