lkml.org 
[lkml]   [2023]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] vsprintf: uninline simple_strntoull(), reorder arguments
On Fri, Oct 27, 2023 at 05:13:58PM +0300, Alexey Dobriyan wrote:
> * uninline simple_strntoull(),
> gcc overinlines and this function is not performance critical
>
> * reorder arguments, so that appending INT_MAX as 4th argument
> generates very efficient tail call
>
> Space savings:
>
> add/remove: 1/0 grow/shrink: 0/3 up/down: 27/-179 (-152)
> Function old new delta
> simple_strntoll - 27 +27
> simple_strtoull 15 10 -5
> simple_strtoll 41 7 -34
> vsscanf 1930 1790 -140


Makes sense to me
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

> if (is_sign)
> - val.s = simple_strntoll(str,
> - field_width >= 0 ? field_width : INT_MAX,
> - &next, base);
> + val.s = simple_strntoll(str, &next, base,
> + field_width >= 0 ? field_width : INT_MAX);
> else
> - val.u = simple_strntoull(str,
> - field_width >= 0 ? field_width : INT_MAX,
> - &next, base);
> + val.u = simple_strntoull(str, &next, base,
> + field_width >= 0 ? field_width : INT_MAX);

Looking at these, why do we even care about signedness? field_witdh IIRC is 16-bit or less
and if size_t is to big it's still fine. No?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2023-10-30 10:00    [W:0.069 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site