Line data Source code
1 : use lief_ffi as ffi;
2 :
3 : use crate::common::FromFFI;
4 :
5 : use super::Operand;
6 :
7 : /// This structure represents a PC-relative operand.
8 : ///
9 : pub struct PCRelative {
10 : ptr: cxx::UniquePtr<ffi::asm_aarch64_operands_PCRelative>,
11 : }
12 :
13 : impl FromFFI<ffi::asm_aarch64_operands_PCRelative> for PCRelative {
14 0 : fn from_ffi(ptr: cxx::UniquePtr<ffi::asm_aarch64_operands_PCRelative>) -> Self {
15 0 : Self { ptr }
16 0 : }
17 : }
18 :
19 : impl Operand for PCRelative {
20 : #[doc(hidden)]
21 0 : fn as_generic(&self) -> &ffi::asm_aarch64_Operand {
22 0 : self.ptr.as_ref().unwrap().as_ref()
23 0 : }
24 : }
25 :
26 : impl PCRelative {
27 : /// The effective value that is relative to the current `rip/eip` register
28 0 : pub fn value(&self) -> i64 {
29 0 : self.ptr.value()
30 0 : }
31 : }
|