Re: [Cbor] Benjamin Kaduk's No Objection on draft-ietf-cbor-network-addresses-09: (with COMMENT)

Carsten Bormann <cabo@tzi.org> Fri, 08 October 2021 10:03 UTC

Return-Path: <cabo@tzi.org>
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 CFF1A3A1602; Fri, 8 Oct 2021 03:03:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 CPNvLIx6omLr; Fri, 8 Oct 2021 03:03:49 -0700 (PDT)
Received: from gabriel-smtp.zfn.uni-bremen.de (gabriel-smtp.zfn.uni-bremen.de [IPv6:2001:638:708:32::15]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D810C3A15FE; Fri, 8 Oct 2021 03:03:46 -0700 (PDT)
Received: from [192.168.217.118] (p5089a8ac.dip0.t-ipconnect.de [80.137.168.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4HQkKq4hwfz2xfQ; Fri, 8 Oct 2021 12:03:43 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <01B8A843-5086-4DB1-8BC1-D7EC261EE55E@tzi.org>
Date: Fri, 08 Oct 2021 12:03:43 +0200
Cc: Benjamin Kaduk <kaduk@mit.edu>, draft-ietf-cbor-network-addresses@ietf.org, Barry Leiba <barryleiba@computer.org>, cbor@ietf.org, The IESG <iesg@ietf.org>, cbor-chairs@ietf.org
X-Mao-Original-Outgoing-Id: 655380223.017779-31762fa9bee1caa89a0b43c8854d60bf
Content-Transfer-Encoding: quoted-printable
Message-Id: <24C25DDD-D6FD-4E71-BA17-563F5495DEE6@tzi.org>
References: <163337270139.24096.2858053457546637595@ietfa.amsl.com> <54845F41-869A-43CE-BF02-825CB728A2CA@tzi.org> <21159.1633552900@localhost> <20211006211924.GI4103@kduck.mit.edu> <10753.1633632955@localhost> <01B8A843-5086-4DB1-8BC1-D7EC261EE55E@tzi.org>
To: Michael Richardson <mcr+ietf@sandelman.ca>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/tgEOjn84cOhtF8HocdurfnahBdE>
Subject: Re: [Cbor] Benjamin Kaduk's No Objection on draft-ietf-cbor-network-addresses-09: (with COMMENT)
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: Fri, 08 Oct 2021 10:04:01 -0000

Strike that; I forgot that C doesn’t actually have a modulo operator (that’s why I’m used to & 7).
Duuh.

Maybe 

unused_bits = (128 - prefix_length_in_bits) % 8;

But that arbitrary 128 causes cognitive dissonance.

Grüße, Carsten


On 2021-10-08, at 09:31, Carsten Bormann <cabo@tzi.org> wrote:
> 
> On 7. Oct 2021, at 20:55, Michael Richardson <mcr+ietf@sandelman.ca> wrote:
>> 
>> unused_bits = (8 - (prefix_length_in_bits % 8) % 8;
> 
> Yes.  If you want to make this simpler, take note that adding 8 to a modulo doesn’t change anything, and use
> 
> unused_bits = (- prefix_length_in_bits) % 8;
> 
> Oh, that’s the current text with & 7 (which is representation specific) replaced by % 8.
> 
> WFM.
> 
> Grüße, Carsten
> 
>