Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/macho-unwind-info/src/raw/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  unaligned.rs   Sprache: unbekannt

 
use std::fmt::Debug;

use zerocopy_derive::{FromBytes, FromZeroes, Unaligned};

/// An unaligned little-endian `u32` value.
#[derive(
    Unaligned, FromZeroes, FromBytes, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
)]
#[repr(transparent)]
pub struct U32([u8; 4]);

impl From<u32> for U32 {
    fn from(n: u32) -> Self {
        U32(n.to_le_bytes())
    }
}

impl From<U32> for u32 {
    fn from(n: U32) -> Self {
        u32::from_le_bytes(n.0)
    }
}

impl Debug for U32 {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        u32::fmt(&(*self).into(), f)
    }
}

/// An unaligned little-endian `u16` value.
#[derive(
    Unaligned, FromZeroes, FromBytes, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
)]
#[repr(transparent)]
pub struct U16([u8; 2]);

impl From<u16> for U16 {
    fn from(n: u16) -> Self {
        U16(n.to_le_bytes())
    }
}

impl From<U16> for u16 {
    fn from(n: U16) -> Self {
        u16::from_le_bytes(n.0)
    }
}

impl Debug for U16 {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        u16::fmt(&(*self).into(), f)
    }
}

[ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet)  ]