Skip to content

Commit bc5e0b8

Browse files
committed
[Rust] Add Platform::address_size
1 parent 75f4b93 commit bc5e0b8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rust/src/platform.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ impl Platform {
165165
unsafe { CoreArchitecture::from_raw(BNGetPlatformArchitecture(self.handle)) }
166166
}
167167

168+
/// Get the address size of the platform, this is typically the same as the architecture's address size,
169+
/// but some platforms like Linux x86_64 x32 ABI have differing address sizes from architecture.
170+
pub fn address_size(&self) -> usize {
171+
unsafe { BNGetPlatformAddressSize(self.handle) }
172+
}
173+
168174
pub fn type_container(&self) -> TypeContainer {
169175
let type_container_ptr = NonNull::new(unsafe { BNGetPlatformTypeContainer(self.handle) });
170176
// NOTE: I have no idea how this isn't a UAF, see the note in `TypeContainer::from_raw`

0 commit comments

Comments
 (0)