#[repr(C)]pub struct RelocationWord {
pub value: u16,
}Expand description
Represents a single relocation entry within a PE base relocation block.
Each relocation entry is stored as a 16-bit value (u16), referred to as a “relocation word.”
The value is divided into two components:
- The upper 4 bits specify the relocation type, which determines how the relocation should be applied.
- The remaining 12 bits specify the offset from the block’s starting RVA where the relocation should be applied.
Fields§
§value: u16A 16-bit value encoding the relocation type and offset.
- Upper 4 bits: relocation type.
- Lower 12 bits: offset from the base RVA.
Implementations§
Source§impl RelocationWord
impl RelocationWord
Sourcepub fn reloc_type(&self) -> u8
pub fn reloc_type(&self) -> u8
Returns the relocation type from the upper 4 bits of Self::value.
Sourcepub fn offset(&self) -> u16
pub fn offset(&self) -> u16
Returns the relocation offset from the lower 16 bits of Self::value.
Trait Implementations§
Source§impl Clone for RelocationWord
impl Clone for RelocationWord
Source§fn clone(&self) -> RelocationWord
fn clone(&self) -> RelocationWord
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RelocationWord
Source§impl Debug for RelocationWord
impl Debug for RelocationWord
Source§impl Default for RelocationWord
impl Default for RelocationWord
Source§fn default() -> RelocationWord
fn default() -> RelocationWord
Returns the “default value” for a type. Read more
Source§impl<'a> IntoCtx<Endian> for &'a RelocationWord
impl<'a> IntoCtx<Endian> for &'a RelocationWord
Source§impl PartialEq for RelocationWord
impl PartialEq for RelocationWord
Source§fn eq(&self, other: &RelocationWord) -> bool
fn eq(&self, other: &RelocationWord) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RelocationWord
Source§impl<'a> TryFromCtx<'a, Endian> for RelocationWordwhere
RelocationWord: 'a,
impl<'a> TryFromCtx<'a, Endian> for RelocationWordwhere
RelocationWord: 'a,
Source§impl<'a> TryIntoCtx<Endian> for &'a RelocationWord
impl<'a> TryIntoCtx<Endian> for &'a RelocationWord
Auto Trait Implementations§
impl Freeze for RelocationWord
impl RefUnwindSafe for RelocationWord
impl Send for RelocationWord
impl Sync for RelocationWord
impl Unpin for RelocationWord
impl UnsafeUnpin for RelocationWord
impl UnwindSafe for RelocationWord
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