Re: [HACKERS] inet data type regression test fails

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: t-ishii(at)sra(dot)co(dot)jp (Tatsuo Ishii)
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] inet data type regression test fails
Date: 1999-03-15 15:25:25
Message-ID: 199903151525.KAA13750@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hi all,
>
> The inet regression test has been failed on my LinuxPPC. While
> investigating the reason, I found a code that doesn't work on
> LinuxPPC. From network_broadcast() in utils/adt/network.c:
>
> int addr = htonl(ntohl(ip_v4addr(ip)) | (0xffffffff >> ip_bits(ip)));
>
> Here ip_bits() returns from (unsigned char)0 to 32. My question is:
> what is the correct result of (0xffffffff >> ip_bits())?
>
> 1. 0x0
> 2. 0xffffffff (actually does nothing)
>
> LinuxPPC is 1. FreeBSD and Solaris are 2. network_broadcast() seems to
> expect 2. My guess is shifting over 32bit against a 32bit integer is
> not permitted and the result is platform depedent. If this would true,
> it could be said that network_broadcast() has a portabilty
> problem. Comments?

If 0xffffff is unsigned, it should allow the right shift. When you say
1 or 2, how do you get those values?

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-03-15 15:27:52 Re: [HACKERS] Postgres Speed or lack thereof
Previous Message Oleg Broytmann 1999-03-15 15:25:13 Re: [HACKERS] VACUUM ANALYZE problem on linux