On Mon, Nov 25, 2013 at 4:24 PM, Yann Ylavic <[email protected]> wrote:

>
> (Note the "int prev_idlers" => "apr_int32_t prev_idlers" too in the patch,
> should int be larger than int32_t, eg. with 64bits int, prev_idlers would
> not become negative is this case...).
>

Just to illustrate, suppose sizeof(int) == sizeof(int64_t) :

#include <apr.h>
#include <stdio.h>

int main(int argc, const char *argv[])
{
    apr_uint32_t u = (apr_uint32_t)1 << 31,
                 k = u - 1;
    apr_int32_t i32 = k - u;


apr_int64_t i64 = k - u;

    printf("%u - %u = %i / %"APR_INT64_T_FMT"\n",
            k, u, i32, i64);
    return 0;
}

$ ./a
.out
2147483647 - 2147483648 = -1 / 4294967295

Reply via email to