This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use long for mantissa for generic mp code


On Tue, Feb 26, 2013 at 07:28:22PM -0800, Richard Henderson wrote:
> On 2013-02-26 18:07, Siddhesh Poyarekar wrote:
> >>>+/* Truncate IN to a multiple of F, where F is a power of two.  */
> >>>>>+#define TRUNCATE_TO_MUL(in, f) ((in) & ~(f))
> >>>
> >>>Err, ~f?  Either this doesn't work at all, or the comment is wrong.
> >Ugh, it should be ~(f - 1).
> >
> 
> Er... we are talking about in % f, when we can't necessarily
> prove that F is a power of 2?
> 
> Then no ~ at all, just (f-1).

Not % f, it's 'align down to F'.  This will only work for F as a power
of two and not any other input.  I didn't put any validation since
that'll just slow things down.

Siddhesh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]