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 {
16 0 : ptr,
17 0 : }
18 0 : }
19 : }
20 :
21 : impl Operand for PCRelative {
22 : #[doc(hidden)]
23 0 : fn as_generic(&self) -> &ffi::asm_aarch64_Operand {
24 0 : self.ptr.as_ref().unwrap().as_ref()
25 0 : }
26 : }
27 :
28 : impl PCRelative {
29 : /// The effective value that is relative to the current `rip/eip` register
30 0 : pub fn value(&self) -> i64 {
31 0 : self.ptr.value()
32 0 : }
33 : }
|