lkml.org 
[lkml]   [2005]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/6] 2.4.19-rc1 number() stack reduction
Badari Pulavarty wrote:

> + /* Move these off of the stack for number(). This way we reduce the
> + * size of the stack and don't have to copy them every time we are called.
> + */
> +const char small_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
> +const char large_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
> +
> static char * number(char * buf, char * end, long long num, int base, int size, int precision, int type)
> {
> char c,sign,tmp[66];
> const char *digits;
> - static const char small_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
> - static const char large_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

Is this actually correct? Since these are declared "static const", they
are not on the stack anyway, because they have to persist between calls
to this function and cannot be changed. I'd be very surprised if the
compiler was copying this data from the static data segment to the stack
on every entry to this function.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.097 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site