Re: [RFC] Add pack()/unpack() support for signed integers with specific endianness

From: Date: Tue, 16 Sep 2025 14:10:03 +0000
Subject: Re: [RFC] Add pack()/unpack() support for signed integers with specific endianness
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-128704@lists.php.net to get a copy of this message
Hi Rob, > Thank you for your work on this. Of all the RFCs I've seen in awhile, this one is one that > I'm most excited to see after writing a protobuf implementation. Happy to see you immediately have a use case in mind while reading this! > If there is one thing I would be over the moon for, it would be for also adding zigzag encoding > as a possible signed integer encoding (maybe using Z/z as the letter)? I wasn't aware this encoding existed. I'm happy to learn about it! Unfortunately, Z is already used with pack/unpack. After a quick research, I think it would be a nice feature. I also noticed that languages like Rust and Python use external packages for this it seems. I guess it would be better to have dedicated functions. I don't think it should be included in this RFC, but that is an interesting idea nevertheless. I'd be really interested if someone comes up with an RFC for this feature! — Alexandre Daubois

« previous php.internals (#128704) next »