From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Is float8 a reference type? |
Date: | 2017-09-23 03:05:05 |
Message-ID: | CAFj8pRAvVMPcH6Bc30fCq-Vi6+foUBm=XQ8U8v8osaZ=zzV14g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2017-09-23 4:52 GMT+02:00 Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>:
> The docs say that a Datum can be 4 bytes or 8 depending on the machine:
>
> https://www.postgresql.org/docs/9.5/static/sql-createtype.html
>
> Is a Datum always 8 bytes for 64-bit architectures?
>
> And if so, can my C extension skip a loop like this when compiling
> there, and just do a memcpy (or even a cast)?:
>
yes, it is 8 bytes on 64-bit.
I don't think so it is good idea to write 64bit only extensions.
> float8 *floats;
> Datum *datums;
>
> datums = palloc(arrlen * sizeof(Datum));
> for (i = 0; i < arrlen; i++) {
> datums[i] = Float8GetDatum(floats[i]);
> }
>
> Thanks!
> Paul
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Paul A Jungwirth | 2017-09-23 03:05:11 | Re: Is float8 a reference type? |
Previous Message | Paul A Jungwirth | 2017-09-23 02:52:33 | Is float8 a reference type? |