Re: [HACKERS] inet data type regression test fails

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Taral <taral(at)taral(dot)net>, Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] inet data type regression test fails
Date: 1999-05-11 00:54:25
Message-ID: 199905110054.JAA00849@ext16.sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > > int addr = htonl(ntohl(ip_v4addr(ip)) | (0xffffffff >> ip_bits(ip)));
> >
> > There needs to be a UL on the end of that constant. Otherwise it depends
> > on whether or not the compiler chooses to make it signed or unsigned. Not
> > only that, but shifting by >=32 is undefined... Intel chipsets will go mod
> > 32 and change 32 to 0.
> >
>
> Anyone want to supply a patch?

This has been already fixed. Now it looks like:

unsigned long mask = 0xffffffff;

if (ip_bits(ip) < 32)
mask >>= ip_bits(ip);
addr = htonl(ntohl(ip_v4addr(ip)) | mask);
---
Tatsuo Ishii

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Taral 1999-05-11 00:58:58 Optimization info
Previous Message Tatsuo Ishii 1999-05-11 00:54:13 Re: [HACKERS] Beta2?