Re: GIST code doesn't build on strict 64-bit machines

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: GIST code doesn't build on strict 64-bit machines
Date: 2004-03-29 16:22:20
Message-ID: 1682.1080577340@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
> I suggest to replace bytea by struct
> typedef struct {
> int32 n; /* number of GISTENTRY */
> GISTENTRY vector[1];
> } GistEntryVector;

Yes, I was thinking the same thing.

> #define GEVHDRSZ (MAXALIGN(sizeof(int32))
> so, allocation will be:
> evec = palloc( GEVHDRSZ + sizeof(GISTENTRY)*n );
> MAXALIGN guarantee that allocated memory will be no less than required (it may
> be greater for 4 bytes).

That would work, or you could use offsetof(GistEntryVector, vector[0]).

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message markw 2004-03-29 16:50:42 Re: PostgreSQL block size vs. LVM2 stripe width
Previous Message Teodor Sigaev 2004-03-29 16:10:05 Re: GIST code doesn't build on strict 64-bit machines