X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftally%2Ftally.c;h=9775cb4e62a3087e070cf9cd28dab8f4b7e051af;hp=d9f30ba12f39cc87c94d2e0e12c4af23177b8add;hb=9dba5bf0cb3f74bf9bcaebd8c63ceaa8c6dcbbab;hpb=4a4985d51c2272569534457388d6178072f36452;ds=sidebyside diff --git a/ccan/tally/tally.c b/ccan/tally/tally.c index d9f30ba1..9775cb4e 100644 --- a/ccan/tally/tally.c +++ b/ccan/tally/tally.c @@ -292,26 +292,27 @@ static int64_t divls64(int64_t u1, uint64_t u0, int64_t v) { int64_t q, uneg, vneg, diff, borrow; - uneg = u1 >> 63; // -1 if u < 0. - if (uneg) { // Compute the absolute - u0 = -u0; // value of the dividend u. + uneg = u1 >> 63; /* -1 if u < 0. */ + if (uneg) { /* Compute the absolute */ + u0 = -u0; /* value of the dividend u. */ borrow = (u0 != 0); u1 = -u1 - borrow; } - vneg = v >> 63; // -1 if v < 0. - v = (v ^ vneg) - vneg; // Absolute value of v. + vneg = v >> 63; /* -1 if v < 0. */ + v = (v ^ vneg) - vneg; /* Absolute value of v. */ if ((uint64_t)u1 >= (uint64_t)v) goto overflow; q = divlu64(u1, u0, v); - diff = uneg ^ vneg; // Negate q if signs of - q = (q ^ diff) - diff; // u and v differed. + diff = uneg ^ vneg; /* Negate q if signs of */ + q = (q ^ diff) - diff; /* u and v differed. */ - if ((diff ^ q) < 0 && q != 0) { // If overflow, return the largest - overflow: // possible neg. quotient. + if ((diff ^ q) < 0 && q != 0) { /* If overflow, return the + largest */ + overflow: /* possible neg. quotient. */ q = 0x8000000000000000ULL; } return q;