Re: [Cbor] Self Described CBOR - Little Endian

Felipe Gasper <felipe@felipegasper.com> Wed, 24 March 2021 15:20 UTC

Return-Path: <felipe@felipegasper.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 82BDE3A2EA1 for <cbor@ietfa.amsl.com>; Wed, 24 Mar 2021 08:20:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.417
X-Spam-Level:
X-Spam-Status: No, score=0.417 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HAS_X_OUTGOING_SPAM_STAT=2.517, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=felipegasper.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XuGWORdjmchj for <cbor@ietfa.amsl.com>; Wed, 24 Mar 2021 08:20:49 -0700 (PDT)
Received: from web1.siteocity.com (web1.siteocity.com [172.241.25.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2C2423A2E99 for <cbor@ietf.org>; Wed, 24 Mar 2021 08:20:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=felipegasper.com; s=default; h=To:References:Message-Id: Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Subject:Mime-Version: Content-Type:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZSGTWvStdGUj41p9MlurAkUHRYQawmtaWxOrRCTsmjQ=; b=UYJJs/QkqgD18MB7iQ3IpxjFe ozsPxEU0ZzsGczm/XiAl8RxTPfKOJksgrXAf5rgb0cRZ1XSquQ6wtMiAMeJHFbrZ2gJV+esCPNHF+ DWToRWHMe/JlvX79fOaB4jIaS29KqkRHGl+KEcwKdVOxPxPI+WwU6rHmGE45kLq7X+XUdQLY2XwHz /IVYaebrItJ7+NJCdIr5GOLHJ2mSa33UCwugBfHVAOiO+RH8/RitvpDhOcR0uJ00KSxuv+SAD3PW3 VCNYTP+s5+eZcK6yBOeqE4OSTjbfmMJgNOK0jWjTTzZkJn/jqBwoEdb39BMFwCcGoex/Gie0D6j15 6Zi4SOd+Q==;
Received: from hou-4.nat.cptxoffice.net ([184.94.197.4]:62445 helo=[10.3.4.84]) by web1.siteocity.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from <felipe@felipegasper.com>) id 1lP5JP-0000GF-MH; Wed, 24 Mar 2021 10:20:48 -0500
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\))
From: Felipe Gasper <felipe@felipegasper.com>
In-Reply-To: <BY5PR20MB2898CBA491A4C0AED983C81CD2649@BY5PR20MB2898.namprd20.prod.outlook.com>
Date: Wed, 24 Mar 2021 11:21:36 -0400
Cc: "cbor@ietf.org" <cbor@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <113AF95E-4048-4093-AC07-44B9E1E3DB0B@felipegasper.com>
References: <BY5PR20MB2898CBA491A4C0AED983C81CD2649@BY5PR20MB2898.namprd20.prod.outlook.com>
To: alex thompson <pierogitus@hotmail.com>
X-Mailer: Apple Mail (2.3445.104.17)
X-OutGoing-Spam-Status: No, score=-1.0
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - web1.siteocity.com
X-AntiAbuse: Original Domain - ietf.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - felipegasper.com
X-Get-Message-Sender-Via: web1.siteocity.com: authenticated_id: fgasper/from_h
X-Authenticated-Sender: web1.siteocity.com: felipe@felipegasper.com
X-Source:
X-Source-Args:
X-Source-Dir:
X-From-Rewrite: unmodified, already matched
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/1HQk0YGzjHRwIG-kcP2NL_nbJtw>
Subject: Re: [Cbor] Self Described CBOR - Little Endian
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Mar 2021 15:20:54 -0000


> On Mar 23, 2021, at 12:50 AM, alex thompson <pierogitus@hotmail.com> wrote:
> 
> ​Given the prevalence of little endian hardware and the existence of the LE typed array tags it would be useful to opt-in to LE encoding of the additional information bytes as well. This would simplify decoders that are specific to LE platforms, particularly WebAssembly which is all LE and hasn’t defined a swap instruction.
> 
> The opt-in could be self described with tag 55798 (has the same non-unicode magic number characteristic as 55799). The beginning of a stream would default to BE so tag 55798 itself would appear as 0xd9d9f6. Then any following tags and descendant items would be LE.
> 
> For completeness, 55798 and 55799 could be nested within one another, switching the endianness as the decoder traverses a tree of items. Nested tags 24 and 63 would pass on their endianness to their embedded items. No effect on typed array tags 64-87.
> 
> It would be a breaking change for generic decoders since ignoring 55798 wouldn’t work as expected but I think the impact is very manageable and fits with CBOR’s stated goals of small code size and extensibility.

I, too, have lamented the use of big-endian byte order in CBOR, FWIW. I *think* my Perl generic decoder works on big-endian machines, but I don’t think I have access to any big-endian machines to actually _test_ it.

-F