MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / get_dec_digits

Function get_dec_digits

components/drivers/serial/serial_tty.c:35–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33static rt_atomic_t _device_id_counter = 0;
34
35static long get_dec_digits(rt_ubase_t val)
36{
37 long result = 1;
38 while (1)
39 {
40 if (val < 10)
41 return result;
42 if (val < 100)
43 return result + 1;
44 if (val < 1000)
45 return result + 2;
46 if (val < 10000)
47 return result + 3;
48 val /= 10000U;
49 result += 4;
50 }
51 return result;
52}
53#endif
54
55static char *alloc_device_name(struct rt_serial_device *serial)

Callers 1

alloc_device_nameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected