MCPcopy Index your code
hub / github.com/encounter/objdiff / calc_matched_percent

Method calc_matched_percent

objdiff-core/src/bindings/report.rs:254–280  ·  view source on GitHub ↗

Calculate the percentage of matched code, data, and functions.

(&mut self)

Source from the content-addressed store, hash-verified

252
253 /// Calculate the percentage of matched code, data, and functions.
254 pub fn calc_matched_percent(&mut self) {
255 self.matched_code_percent = if self.total_code == 0 {
256 100.0
257 } else {
258 self.matched_code as f32 / self.total_code as f32 * 100.0
259 };
260 self.matched_data_percent = if self.total_data == 0 {
261 100.0
262 } else {
263 self.matched_data as f32 / self.total_data as f32 * 100.0
264 };
265 self.matched_functions_percent = if self.total_functions == 0 {
266 100.0
267 } else {
268 self.matched_functions as f32 / self.total_functions as f32 * 100.0
269 };
270 self.complete_code_percent = if self.total_code == 0 {
271 100.0
272 } else {
273 self.complete_code as f32 / self.total_code as f32 * 100.0
274 };
275 self.complete_data_percent = if self.total_data == 0 {
276 100.0
277 } else {
278 self.complete_data as f32 / self.total_data as f32 * 100.0
279 };
280 }
281}
282
283impl From<&ReportItem> for ChangeItemInfo {

Callers 5

migrate_v0Method · 0.80
from_iterMethod · 0.80
fromMethod · 0.80
report_objectFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected