# Trait miri::interpret::PointerArithmetic

source ·

    pub trait PointerArithmetic: HasDataLayout {
        // Provided methods
        fn pointer_size(&self) -> Size { ... }
        fn max_size_of_val(&self) -> Size { ... }
        fn target_usize_max(&self) -> u64 { ... }
        fn target_isize_min(&self) -> i64 { ... }
        fn target_isize_max(&self) -> i64 { ... }
        fn target_usize_to_isize(&self, val: u64) -> i64 { ... }
        fn truncate_to_ptr(&self, _: (u64, bool)) -> (u64, bool) { ... }
        fn overflowing_offset(&self, val: u64, i: u64) -> (u64, bool) { ... }
        fn overflowing_signed_offset(&self, val: u64, i: i64) -> (u64, bool) { ... }
        fn offset<'tcx>(
            &self,
            val: u64,
            i: u64
        ) -> Result<u64, InterpErrorInfo<'tcx>> { ... }
        fn signed_offset<'tcx>(
            &self,
            val: u64,
            i: i64
        ) -> Result<u64, InterpErrorInfo<'tcx>> { ... }
    }

## Provided Methods§

source

#### fn pointer_size(&self) -> Size

source

#### fn max_size_of_val(&self) -> Size

source

#### fn target_usize_max(&self) -> u64

source

#### fn target_isize_min(&self) -> i64

source

#### fn target_isize_max(&self) -> i64

source

#### fn target_usize_to_isize(&self, val: u64) -> i64

source

#### fn truncate_to_ptr(&self, _: (u64, bool)) -> (u64, bool)

Helper function: truncate given value-“overflowed flag” pair to pointer size and update “overflowed flag” if there was an overflow. This should be called by all the other methods before returning!

source

#### fn overflowing_offset(&self, val: u64, i: u64) -> (u64, bool)

source

#### fn overflowing_signed_offset(&self, val: u64, i: i64) -> (u64, bool)

source

#### fn offset<'tcx>(&self, val: u64, i: u64) -> Result<u64, InterpErrorInfo<'tcx>>

source

#### fn signed_offset<'tcx>( &self, val: u64, i: i64 ) -> Result<u64, InterpErrorInfo<'tcx>>

## Implementors§

source§

### impl<T> PointerArithmetic for T
where T: HasDataLayout,