Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-24 Thread George Spelvin
Michal Nazarewicz wrote: > On Fri, Aug 03 2012, George Spelvin wrote: >> Shrink the reciprocal approximations used in put_dec_full4 >> based on the comments in put_dec_full9. > > Have you verified that the comment is correct? I rechecked all the validity limits myself. >> r = (q *

Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-24 Thread George Spelvin
>> +/* See comment in put_dec_full9 for choice of constants */ >> static noinline_for_stack >> char *put_dec_full4(char *buf, unsigned q) >> { >> unsigned r; >> - r = (q * 0xcccd) >> 19; >> + r = (q * 0xccd) >> 15; >> *buf++ = (q - 10 * r) + '0'; >> -

Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-24 Thread Denys Vlasenko
On Fri, Aug 3, 2012 at 7:21 AM, George Spelvin wrote: > Shrink the reciprocal approximations used in put_dec_full4 > based on the comments in put_dec_full9. > > Signed-off-by: George Spelvin > Cc: Denys Vlasenko > Cc: Michal Nazarewicz > --- > lib/vsprintf.c |5 +++-- > 1 file changed, 3

Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-24 Thread Denys Vlasenko
On Fri, Aug 3, 2012 at 7:21 AM, George Spelvin li...@horizon.com wrote: Shrink the reciprocal approximations used in put_dec_full4 based on the comments in put_dec_full9. Signed-off-by: George Spelvin li...@horizon.com Cc: Denys Vlasenko vda.li...@googlemail.com Cc: Michal Nazarewicz

Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-24 Thread George Spelvin
+/* See comment in put_dec_full9 for choice of constants */ static noinline_for_stack char *put_dec_full4(char *buf, unsigned q) { unsigned r; - r = (q * 0xcccd) 19; + r = (q * 0xccd) 15; *buf++ = (q - 10 * r) + '0'; - q = (r * 0x199a)

Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-24 Thread George Spelvin
Michal Nazarewicz m...@google.com wrote: On Fri, Aug 03 2012, George Spelvin li...@horizon.com wrote: Shrink the reciprocal approximations used in put_dec_full4 based on the comments in put_dec_full9. Have you verified that the comment is correct? I rechecked all the validity limits myself.

Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-23 Thread Michal Nazarewicz
On Fri, Aug 03 2012, George Spelvin wrote: > Shrink the reciprocal approximations used in put_dec_full4 > based on the comments in put_dec_full9. > > Signed-off-by: George Spelvin > Cc: Denys Vlasenko > Cc: Michal Nazarewicz Have you verified that the comment is correct? > --- >

Re: [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-09-23 Thread Michal Nazarewicz
On Fri, Aug 03 2012, George Spelvin li...@horizon.com wrote: Shrink the reciprocal approximations used in put_dec_full4 based on the comments in put_dec_full9. Signed-off-by: George Spelvin li...@horizon.com Cc: Denys Vlasenko vda.li...@googlemail.com Cc: Michal Nazarewicz min...@mina86.com

[PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-08-02 Thread George Spelvin
Shrink the reciprocal approximations used in put_dec_full4 based on the comments in put_dec_full9. Signed-off-by: George Spelvin Cc: Denys Vlasenko Cc: Michal Nazarewicz --- lib/vsprintf.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) I was looking over the code and noticed

[PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers.

2012-08-02 Thread George Spelvin
Shrink the reciprocal approximations used in put_dec_full4 based on the comments in put_dec_full9. Signed-off-by: George Spelvin li...@horizon.com Cc: Denys Vlasenko vda.li...@googlemail.com Cc: Michal Nazarewicz min...@mina86.com --- lib/vsprintf.c |5 +++-- 1 file changed, 3 insertions(+),