Re: [Cbor] Self Described CBOR - Little Endian

Joe Hildebrand <hildjj@cursive.net> Wed, 24 March 2021 20:10 UTC

Return-Path: <hildjj@cursive.net>
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 C2DED3A3511 for <cbor@ietfa.amsl.com>; Wed, 24 Mar 2021 13:10:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.697
X-Spam-Level:
X-Spam-Status: No, score=-1.697 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=neutral reason="invalid (public key: not available)" header.d=cursive.net
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 RopPvwFdWdph for <cbor@ietfa.amsl.com>; Wed, 24 Mar 2021 13:09:59 -0700 (PDT)
Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 287933A350F for <cbor@ietf.org>; Wed, 24 Mar 2021 13:09:59 -0700 (PDT)
Received: by mail-io1-xd33.google.com with SMTP id n198so22871098iod.0 for <cbor@ietf.org>; Wed, 24 Mar 2021 13:09:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cursive.net; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=GfaM77YbCH9mUJFAMLlGnzMWsoggC+K2sU9Oe1g6IRY=; b=bg7zbQGChNoFwNlPPfz9HyTze3Djx91PU1Q8UDVBY+u/aeWkuW2CpI5zHaT041E4g8 X4tFZBUWnHUbjHFCstudB/iDoum7AX81cqrNzcwdu1BVl0UiaAbYPsXcv+8cyPjiGnfH bYvm1VHqn+e76E+4DcoTDKfgDZfWG8mSGZHTw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=GfaM77YbCH9mUJFAMLlGnzMWsoggC+K2sU9Oe1g6IRY=; b=iMRkleWg2qXg5sFnz+lpy0j3WlQ5YMRTRY1mIiaDxujD+8UhAQ+D4Zrz/UXjEsFBPC 49A2z2ajeLScEtJhLSDWccEd6MeRZBGV7asTpAEUMKkYdJpt2mmk4Xu7C5sDwvRSjwI+ LuWcRtDB9HsTJWrpByXG31ymyU3409bBOWzS+Q5hHxBNRsHRnE7sTAJyMfKx3qfhWASq xJyNLUU5VJWRWZ5AX+ENHV1jIGy8hxP+/3YYHVJNApMGK/W7jpKDsGSChry7ftDJHaHj HbIUfRBOoLJIWnSatsYoNIpctMiKoWlO5A3Kry6RJYWhB2HxvgTKYkU4QYkRmBKCuimN jxug==
X-Gm-Message-State: AOAM532rHS8L1hhT9/Rztm+OF367QdrIsyhIKOWXJWfAgUEt7NmL/uLa BdIq4iYhwobq8kIOm1zJnS5eNA==
X-Google-Smtp-Source: ABdhPJwwFBIgdPj8EV0CNdgUALiGqgNuJNINmDXwEa5BDHZf10aw34Qa3wLf7oKo0ktY5JI74ImDUg==
X-Received: by 2002:a05:6638:218f:: with SMTP id s15mr4516470jaj.58.1616616597076; Wed, 24 Mar 2021 13:09:57 -0700 (PDT)
Received: from ?IPv6:2601:282:200:11c0:b1f4:81d1:7d97:eaa9? ([2601:282:200:11c0:b1f4:81d1:7d97:eaa9]) by smtp.gmail.com with ESMTPSA id g16sm1565505iln.29.2021.03.24.13.09.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Mar 2021 13:09:56 -0700 (PDT)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\))
From: Joe Hildebrand <hildjj@cursive.net>
In-Reply-To: <113AF95E-4048-4093-AC07-44B9E1E3DB0B@felipegasper.com>
Date: Wed, 24 Mar 2021 14:09:55 -0600
Cc: alex thompson <pierogitus@hotmail.com>, "cbor@ietf.org" <cbor@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <ED83658C-0602-4845-AD5B-9850F803BDD7@cursive.net>
References: <BY5PR20MB2898CBA491A4C0AED983C81CD2649@BY5PR20MB2898.namprd20.prod.outlook.com> <113AF95E-4048-4093-AC07-44B9E1E3DB0B@felipegasper.com>
To: Felipe Gasper <felipe@felipegasper.com>
X-Mailer: Apple Mail (2.3654.60.0.2.21)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/jXKkPaQm_W8DvsGmRrh6ZXlyMGk>
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 20:10:04 -0000

The `s390x/node` docker image emulates big endian (slowly), and includes Perl 5.24.1

I test with "docker run --rm -it -v ${PWD}:/root/cbor -w /root/cbor s390x/node npm test"

— 
Joe Hildebrand

> On Mar 24, 2021, at 9:21 AM, Felipe Gasper <felipe@felipegasper.com> wrote:
> 
> 
> 
>> 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
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor