`On Wed, 2012-02-01 at 17:38 -0800, Paul Turner wrote:> +/* Precomputed fixed inverse multiplies for multiplication by y^n */> +const static u32 runnable_avg_yN_inv[] = {> +       0xffffffff,0xfa83b2db,0xf5257d15,0xefe4b99b,0xeac0c6e7,0xe5b906e7,> +       0xe0ccdeec,0xdbfbb797,0xd744fcca,0xd2a81d91,0xce248c15,0xc9b9bd86,> +       0xc5672a11,0xc12c4cca,0xbd08a39f,0xb8fbaf47,0xb504f333,0xb123f581,> +       0xad583eea,0xa9a15ab4,0xa5fed6a9,0xa2704303,0x9ef53260,0x9b8d39b9,> +       0x9837f051,0x94f4efa8,0x91c3d373,0x8ea4398b,0x8b95c1e3,0x88980e80,> +       0x85aac367,0x82cd8698,> +};I wonder if modern Intel isn't at the point where computing this thingis cheaper than the cacheline miss. You can compute y^n in O(log n) timeand with n < 32 that's 5 multiplications (see fixed_power_int). Add tothat the division.Of course there's platforms, ARM?, where reverse is likely true. Buggerthat.> +/* Precomputed \Sum y^k { 1<=k<=n } */> +const static u32 runnable_avg_yN_sum[] = {> +           0, 1002, 1982, 2941, 3880, 4798, 5697, 6576, 7437, 8279, 9103,> +        9909,10698,11470,12226,12966,13690,14398,15091,15769,16433,17082,> +       17718,18340,18949,19545,20128,20698,21256,21802,22336,22859,23371,> +}; Right, can't see a fast way to compute this..The asymmetry in the tables annoys me though 32 vs 33 entries, hex vsdec :-)`