MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / count_digits

Function count_digits

atomic-core/src/output/repo/writer.rs:342–353  ·  view source on GitHub ↗

Count the number of digits in a u32.

(n: u32)

Source from the content-addressed store, hash-verified

340
341/// Count the number of digits in a u32.
342fn count_digits(n: u32) -> u32 {
343 if n == 0 {
344 return 1;
345 }
346 let mut count = 0;
347 let mut num = n;
348 while num > 0 {
349 count += 1;
350 num /= 10;
351 }
352 count
353}
354
355// WRITE TRAIT IMPLEMENTATION
356

Callers 1

write_markerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected