diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c index 0ab54316f8..60c2b76175 100644 --- a/src/backend/utils/adt/network.c +++ b/src/backend/utils/adt/network.c @@ -1889,7 +1889,7 @@ inetnot(PG_FUNCTION_ARGS) unsigned char *pip = ip_addr(ip); unsigned char *pdst = ip_addr(dst); - while (nb-- > 0) + while (--nb >= 0) pdst[nb] = ~pip[nb]; } ip_bits(dst) = ip_bits(ip); @@ -1921,7 +1921,7 @@ inetand(PG_FUNCTION_ARGS) unsigned char *pip2 = ip_addr(ip2); unsigned char *pdst = ip_addr(dst); - while (nb-- > 0) + while (--nb >= 0) pdst[nb] = pip[nb] & pip2[nb]; } ip_bits(dst) = Max(ip_bits(ip), ip_bits(ip2)); @@ -1953,7 +1953,7 @@ inetor(PG_FUNCTION_ARGS) unsigned char *pip2 = ip_addr(ip2); unsigned char *pdst = ip_addr(dst); - while (nb-- > 0) + while (--nb >= 0) pdst[nb] = pip[nb] | pip2[nb]; } ip_bits(dst) = Max(ip_bits(ip), ip_bits(ip2)); @@ -1978,7 +1978,7 @@ internal_inetpl(inet *ip, int64 addend) unsigned char *pdst = ip_addr(dst); int carry = 0; - while (nb-- > 0) + while (--nb >= 0) { carry = pip[nb] + (int) (addend & 0xFF) + carry; pdst[nb] = (unsigned char) (carry & 0xFF); @@ -2062,7 +2062,7 @@ inetmi(PG_FUNCTION_ARGS) unsigned char *pip2 = ip_addr(ip2); int carry = 1; - while (nb-- > 0) + while (--nb >= 0) { int lobyte;