Re: new library

From: Al Viro
Date: Thu Jan 11 2024 - 20:07:09 EST


On Thu, Jan 11, 2024 at 09:48:46PM -0300, Guilherme Giácomo Simões wrote:

> For ex: 1234 -> "12.34", and i show this in dmesg output: [09876] 12.34

Er... What's wrong with "%d.%0*d", n / 100, 2, n % 100 in sprintf/printk/etc.
arguments? It's slightly messier if you want to handle the negatives as well,
but also not impossible - "%s%d.%0*d", n < 0 ? "-" : "", abs(n) / 100, 2, abs(n) % 100
will do it, kernel and userland alike. And I'm pretty sure it's going to be cheaper
than your solution...