[lkml]   [2010]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [RFC][PATCH] introduce ptr_diff()
    > I'm not sure the price is so high.  I googled around and came across
    > (section 3.3). Dividing by
    > 2^n, (2^n + 2^m) or (2^n - 2^m) can be done using a small series of adds
    > and subtractions (important on ARM as it had no divide instruction at
    > the time). Most structures are going to be of one of these sizes ...
    > and in particular, struct page is 56 bytes in my config, which is 64 - 8.
    > Maybe sparse needs to be taught that dividing by 2^n [+-] 2^m is cheap
    > enough to not warn about.

    Usually you can just use x/n = x*(1/n) and generate *(1/n) with 1/n
    being computed at compile time. Multiplications are fast in hardware.

    gcc only does that when -Os is not set though (friends don't let friends
    compile with -Os...)


    -- -- Speaking for myself only.

     \ /
      Last update: 2010-08-20 15:01    [W:0.021 / U:3.704 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site