diff options
| author | Mason Reed <mason@vector35.com> | 2026-01-20 14:30:34 -0800 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-03-23 21:50:02 -0700 |
| commit | 1e85844d6407db817db25fd43f1dd9756ef0c3ae (patch) | |
| tree | d6d2df2c3ed9403604fecff294be88d70fce5cf7 /rust | |
| parent | 1f98e7ca7cce35ae4c2b4741f33e9892dd695534 (diff) | |
IDB Import refactor
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/types/structure.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/src/types/structure.rs b/rust/src/types/structure.rs index 7de466a4..3b609287 100644 --- a/rust/src/types/structure.rs +++ b/rust/src/types/structure.rs @@ -571,6 +571,16 @@ impl StructureMember { pub fn bit_offset(&self) -> u64 { (self.offset * 8) + self.bit_position.unwrap_or(0) as u64 } + + /// Member width in bits. + /// + /// NOTE: This is a helper to calculate the bit width of the member, even for non-bitfield members. + /// This is not to be confused with the field `bit_width`, which is set for only bitfield members. + pub fn width_in_bits(&self) -> u64 { + self.bit_width + .map(|w| w as u64) + .unwrap_or(self.ty.contents.width() * 8) + } } impl CoreArrayProvider for StructureMember { |
