On Mon, Jan 25, 2016 at 8:56 PM, James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote: > On Mon, 2016-01-25 at 18:02 +0000, Elliott, Robert (Persistent Memory) > wrote: > Using ffs leads to precision runaway How exactly?! > and > exporting an array from string_helpers.c is simply the wrong way to do > it. This part I didn't object. > Since we've now spent more time arguing about this than it would take > to do a correct patch, this is what I was thinking. It extracts the > precision reduction core from string_helpers.c and exposes it to all > users who want to convert to units. I added a nozeros option becuase I > think you want it to print 1 GiB rather than 1.00 GiB for exact powers > of two. (OK, and I fixed a bug where it will report small amounts as > 1.00 B instead of whole number of bytes). Absent the nozero option, > you could simply have used string_get_size(), with a block size of 1. It's good you are doing this better, but I still vote for __ffs64(), since it would be faster on binary units. Also, in one version I tried to convert couple of other users which are using only KM (in general whatever range it would be) units. Any ideas how to modify to support them? -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html