public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Fetter <[email protected]>
To: Joel Jacobson <[email protected]>
Cc: Aleksander Alekseev <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] Add get_bytes() and set_bytes() functions
Date: Wed, 14 Aug 2024 16:43:51 +0200
Message-ID: <ZrzCpy36C9w/[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAJ7c6TPtOp6+kFX5QX3fH1SVr7v65uHr-7yEJ=GMGQi5uhGtcA@mail.gmail.com>
	<[email protected]>
	<CAJ7c6TNVbeNsxbbj1QJTcjdkHRmJUBfF=iv_dOMDAGxoKY9CyQ@mail.gmail.com>
	<[email protected]>

On Wed, Aug 14, 2024 at 02:34:06PM +0200, Joel Jacobson wrote:
> On Wed, Aug 14, 2024, at 13:31, Aleksander Alekseev wrote:
> >> I wonder if get_bytes() and set_bytes() will behave differently
> >> on little-endian vs big-endian systems?
> > No, the returned value will not depend on the CPU endiness. Current
> > implementation uses big-endian / network order which in my humble
> > opinion is what most users would expect.
> 
> Nice.

Indeed!

> I've reviewed and tested the patch.
> It looks straight-forward to me.
> I don't see any potential problems.
> I've marked it Ready for Committer.
> 
> > I believe we also need reverse(bytea) and repeat(bytea, integer)
> > functions e.g. for those who want little-endian. However I want to
> > propose them separately when we are done with this patch.
> 
> I agree those functions would be nice too.
> 
> I also think it would be nice to provide these convenience functions:
> to_bytes(bigint) -> bytea
> from_bytes(bytea) -> bigint

Along with these, would it make sense to have other forms of these
that won't choke at 63 bits, e.g. NUMERIC or TEXT?

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778






view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Add get_bytes() and set_bytes() functions
  In-Reply-To: <ZrzCpy36C9w/[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox