Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128713 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 9A43A1A00BC for ; Thu, 18 Sep 2025 09:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1758186866; bh=Ma32lT3YD2LNmELqYUkyIQ1x9BkD7im8z0k27L+zRi8=; h=From:Subject:Date:References:To:In-Reply-To:From; b=TwQi6+8iy0o/dvnwOP3lkdOBXiyT6Gh47E8Nxqsd3JRQNZ8ji0u6MasvOZrqH30gl yB1/W3RV+tS1/goK/6e0WcpxhrHslyDDWGEGVBGn00hY0nrgdc1d62jw2qzwIijCcZ vnzsN+8NIdw0c8DCS0VIdxP03+aVwetxFOQZeM+FCk1sdm5ayYx8LVa6V1EBinpeem /Cfj91n4uJKlz37r5wXJRwSMn7Ejzvr/EOGqYLDqkYsQwAZMOm6useahe0vkhL13R5 vBrZK3IjL6nSpHo+g2e846EwoFSknpnhE3d8eR7LnvRNCynFYlucB/B0qCxhbANDld 2XLYHx7fEvvxg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4863818004E for ; Thu, 18 Sep 2025 09:14:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail.gna.ch (darkcity.gna.ch [84.234.28.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 18 Sep 2025 09:14:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.gna.ch (Postfix) with ESMTP id CCBE42381221 for ; Thu, 18 Sep 2025 11:15:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1758186942; bh=Ma32lT3YD2LNmELqYUkyIQ1x9BkD7im8z0k27L+zRi8=; h=From:Subject:Date:References:To:In-Reply-To; b=e113aYDYo3KvNc76OcA+6BTZy7k++Xile0vPPixFNz4c1JvULvDvcp7AjBwgHo+dO k9GAP4goQSphaStrMal3eLcdvRCFRIQDYcxbB7Fq+bnr9lpR+rndIbNBgdtTsGFWmK gxHjguLbotlparfSGi+UxKwGEtej92c3tKCiaaGA= X-Virus-Scanned: amavisd-new at gna.ch Received: from mail.gna.ch ([127.0.0.1]) by localhost (mail.gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J9C23vRWi3w1 for ; Thu, 18 Sep 2025 11:15:42 +0200 (CEST) Received: from smtpclient.apple (unknown [IPv6:2a02:1210:2e2d:4d00:61f1:6e4:9e27:ff1a]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.gna.ch (Postfix) with ESMTPSA id F3D5B2380A44 for ; Thu, 18 Sep 2025 11:15:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1758186942; bh=Ma32lT3YD2LNmELqYUkyIQ1x9BkD7im8z0k27L+zRi8=; h=From:Subject:Date:References:To:In-Reply-To; b=e113aYDYo3KvNc76OcA+6BTZy7k++Xile0vPPixFNz4c1JvULvDvcp7AjBwgHo+dO k9GAP4goQSphaStrMal3eLcdvRCFRIQDYcxbB7Fq+bnr9lpR+rndIbNBgdtTsGFWmK gxHjguLbotlparfSGi+UxKwGEtej92c3tKCiaaGA= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.100.1.1.5\)) Subject: Re: [PHP-DEV] [RFC] Add pack()/unpack() support for signed integers with specific endianness Date: Thu, 18 Sep 2025 11:15:40 +0200 References: To: PHP internals list In-Reply-To: Message-ID: <16763451-A8D8-4519-98FF-6DD99883A00A@cschneid.com> X-Mailer: Apple Mail (2.3864.100.1.1.5) From: cschneid@cschneid.com (Christian Schneider) Am 16.09.2025 um 13:45 schrieb Alexandre Daubois = : > I=E2=80=99d like to present this new RFC. When discussing the issue, = we first thought that the RFC process wasn=E2=80=99t necessary. However, = discussions on the PR showed that selecting new letters for pack and = unpack is more challenging than we initially thought, thus creating an = RFC for this change. >=20 > Here is the link to the RFC: = https://wiki.php.net/rfc/pack-unpack-endianness-signed-integers-support Just a little side-note: unpackToSignedInt can be implemented more = easily, e.g. like function unpackToSignedInt($bytes) { return ($uint32 =3D unpack('V', $bytes)[1]) < 2 ** 31 ? $uint32 = : $uint32 - 2 ** 32; # Use 'N' for big endian } While I undestand the wish for having all different sizes in all = different endian-ness I don't think it is that big of an issue for = people dealing with binary data, so I'm +-0 whether PHP really needs it. Regards, - Chris