This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH] Reduce code size of _REENT_INIT_PTR()
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: Eric Blake <eblake at redhat dot com>
- Cc: Sebastian Huber <sebastian dot huber at embedded-brains dot de>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 26 Apr 2013 09:45:22 -0500
- Subject: Re: [PATCH] Reduce code size of _REENT_INIT_PTR()
- References: <1366965833-13948-1-git-send-email-sebastian dot huber at embedded-brains dot de> <517A56F6 dot 8010406 at redhat dot com>
On 4/26/2013 5:29 AM, Eric Blake wrote:
On 04/26/2013 02:43 AM, Sebastian Huber wrote:
Use one memset() to initialize everything to zero. Set non-zero fields
in a second step. There is only a small runtime overhead, but the code
size is greatly reduced. This change assumes the NULL pointer and '\0'
are encoded as zero bits.
'\0' is required to be all zero bits by C99; no assumption required.
NULL is allowed to be encoded as non-zero bits, but such systems are
extremely rare, and I don't know of any newlib target that violates the
assumption (that is, we have other code in newlib that assumes a memset
to 0 correctly initializes null pointer values).
Is that a blessing to commit this Eric?
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985