pub enum CpuRegisterSize {
Bit64,
Bit32,
}Expand description
CPU register size enumeration.
Identifies whether the target CPU uses 32-bit or 64-bit registers. This is used for platform-specific tick count overflow handling and time calculation optimizations.
§Usage
Typically determined at compile time via register_bit_size() which
checks size_of::<usize>().
§Examples
ⓘ
use osal_rs::utils::{CpuRegisterSize, register_bit_size};
match register_bit_size() {
CpuRegisterSize::Bit64 => {
// Use 64-bit optimized calculations
}
CpuRegisterSize::Bit32 => {
// Use 32-bit overflow-safe calculations
}
}Variants§
Bit64
64-bit CPU registers (e.g., ARM Cortex-A, x86_64).
On these platforms, usize is 8 bytes.
Bit32
32-bit CPU registers (e.g., ARM Cortex-M, RP2040, ESP32).
On these platforms, usize is 4 bytes.
Trait Implementations§
Source§impl Clone for CpuRegisterSize
impl Clone for CpuRegisterSize
Source§fn clone(&self) -> CpuRegisterSize
fn clone(&self) -> CpuRegisterSize
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CpuRegisterSize
impl Debug for CpuRegisterSize
Source§impl PartialEq for CpuRegisterSize
impl PartialEq for CpuRegisterSize
impl Copy for CpuRegisterSize
impl Eq for CpuRegisterSize
impl StructuralPartialEq for CpuRegisterSize
Auto Trait Implementations§
impl Freeze for CpuRegisterSize
impl RefUnwindSafe for CpuRegisterSize
impl Send for CpuRegisterSize
impl Sync for CpuRegisterSize
impl Unpin for CpuRegisterSize
impl UnsafeUnpin for CpuRegisterSize
impl UnwindSafe for CpuRegisterSize
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more