[Bug c/28417] suboptimal 'division by constant' optimization

2006-07-18 Thread vda dot linux at googlemail dot com
--- Comment #1 from vda dot linux at googlemail dot com 2006-07-18 08:40 --- I didn't look too close at choose_multiplier(), yet. If anybody will work upon it in order to make it better, this is the routine which prints values 'K' and 'bits' so that (A*K)>>bits == A/B is true for gi

[Bug c/28417] suboptimal 'division by constant' optimization

2006-07-18 Thread vda dot linux at googlemail dot com
--- Comment #2 from vda dot linux at googlemail dot com 2006-07-18 12:06 --- Pseudo-code to help in reading above code: void fastdiv_params(unsigned B, unsigned max_A) { L = (max_unsigned_long_long/max_unsigned - 1) * B; L = largest_pow2_smaller_or_eq_to(L); bit