Re: Is 1111 1110 10 equal to 0xfe80 or 0x3fa?

Warren Kumari <warren@kumari.net> Thu, 06 June 2019 20:18 UTC

Return-Path: <warren@kumari.net>
X-Original-To: ipv6@ietfa.amsl.com
Delivered-To: ipv6@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BCA9C12009C for <ipv6@ietfa.amsl.com>; Thu, 6 Jun 2019 13:18:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=kumari-net.20150623.gappssmtp.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 FSKKFciH_Moi for <ipv6@ietfa.amsl.com>; Thu, 6 Jun 2019 13:18:01 -0700 (PDT)
Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (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 A1906120114 for <ipv6@ietf.org>; Thu, 6 Jun 2019 13:18:01 -0700 (PDT)
Received: by mail-qk1-x731.google.com with SMTP id i125so2320568qkd.6 for <ipv6@ietf.org>; Thu, 06 Jun 2019 13:18:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kumari-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=1ubLc0mKyVVBgnrxsNNNT5p0wiKXmCxkudiCi+Nx8Vc=; b=NE4uQWsBQzrXkStNTVW951KPdmx78BQa7x58ok492cl36bgbCGYmQoIBK39yn9LC8m v1AifFDYUAhrxGArzxu8qfrl07LTvn+ygcbZjuhcUKkdTrnmhITS0xxnorhkBlAyXnGR 9pMXkhP9H4ZUAz3Ov/7rgD2HlMeRcHb8YIWJI5WQwlJDbZCvM57E4SD7Ig5Zpxdu9dhv qCfaQ7WhbRsB5iIZR/n98vNKwjZcsJGIYGDZdf1QAFVfY0MlXmV/QHJ5rp0qmWWpbfXD FSnqP9L9dwBT2ho9H7zY1pLJKgxh/oHxv3b/XriG+h89DY4x/xKHqX8Ej8IBZX3GAQSP fX6A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=1ubLc0mKyVVBgnrxsNNNT5p0wiKXmCxkudiCi+Nx8Vc=; b=NQWcUVkkzrrsPBEJdHQLFyDFv96zMQAivCwj4jHjwHQyQqRAu3ed/VgbY4xEOJI3YX X9co0MVVk/r70kKExsyQjaiHOPHat3nPeIb5rWF6UiqdQf8J0BUX96dDBeOp4K3RlGr2 2/u85CIOZ/V4ZxHr8NgU1nLcc6AIFbanHibuMaHR3TkkLz0ZWP30lI5SC5YCxoRfMm4Z JV9oKLVC7Ocu3U925oTq/0uAmLyE7dRZaLe3qjOzOvi02IR7KD5jOKBFUDje/z/h4UvY dWqwjrnFwQgZgA4p/OIT7JSvsYYQy8160/7NfHx2OC05Q3ev3O9hUEkHIPIsLJ1ST4ba 38pQ==
X-Gm-Message-State: APjAAAVk+BUfmB9U7Aq+h00QDIe6d94Q2rLUAASPhClqf/qB6icMvwBF 6j/+8soXf6784F3nyK8rwb7I7TVTXO43+cONy9kZjA==
X-Google-Smtp-Source: APXvYqwfJoyp/tm9a0wtI962yh0826aklYlgfzZ8yNhXiPIf/Lc20Gk6BkLFai6NoW+N94PbdBW3H/diIBNI6q0jwRw=
X-Received: by 2002:a37:5b44:: with SMTP id p65mr39760843qkb.185.1559852280066; Thu, 06 Jun 2019 13:18:00 -0700 (PDT)
MIME-Version: 1.0
References: <a71b00b7-0e0c-242a-b3f7-147f4c6b2eb0@gmail.com> <D05C857F-42F6-4F17-8520-A0BF4C8FB775@steffann.nl>
In-Reply-To: <D05C857F-42F6-4F17-8520-A0BF4C8FB775@steffann.nl>
From: Warren Kumari <warren@kumari.net>
Date: Thu, 06 Jun 2019 16:17:23 -0400
Message-ID: <CAHw9_i+U90wczYJ9RwBnzqCd09qfjoPBhNv5sH_wRHfJ9RkGjQ@mail.gmail.com>
Subject: Re: Is 1111 1110 10 equal to 0xfe80 or 0x3fa?
To: Sander Steffann <sander@steffann.nl>
Cc: Alexandre Petrescu <alexandre.petrescu@gmail.com>, IPv6 <ipv6@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipv6/67Jxh3NdtanBrSKNupDOiQTIZ40>
X-BeenThere: ipv6@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "IPv6 Maintenance Working Group \(6man\)" <ipv6.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipv6>, <mailto:ipv6-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ipv6/>
List-Post: <mailto:ipv6@ietf.org>
List-Help: <mailto:ipv6-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipv6>, <mailto:ipv6-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 06 Jun 2019 20:18:04 -0000

On Thu, Jun 6, 2019 at 2:46 PM Sander Steffann <sander@steffann.nl> wrote:
>
> Hi Alexandre,
>
> > I maintain that 1111 1110 10 equals 0x3fa, because that's what my Windows Calculator says: I type 1111 1110 10 and it converts to 0x3fa.
> >
> > On another hand, I am rhetorically asked how can 1111 1110 10 be 0x3fa?
> >
> > (the 1111 1110 10 are the 10 leading bits of the IPv6 link local addresses, which is familiarly known to start with an fe80).
> >
> > On my side, this is a difficulty to understand this 0xfe80, especially since 1111 1110 10 is so printed in Figure in RFC4291.
>
> It's a prefix of an IPv6 address. IPv6 addresses are 128 bits long. Expand to 128 bits and try again :)
>
> 1111 1110 1000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 equals 0xfe800000000000000000000000000000. Not sure if Windows Calculator can handle that though…

Windows calc probably can't, but:
$ echo 'print hex(0b1111111010 << (128-10))'  | python

or https://repl.it/repls/AwareDecentGeeklog if you don't have Python
(because windows :-p)

W
>
> Cheers,
> Sander
>
> --------------------------------------------------------------------
> IETF IPv6 working group mailing list
> ipv6@ietf.org
> Administrative Requests: https://www.ietf.org/mailman/listinfo/ipv6
> --------------------------------------------------------------------



-- 
I don't think the execution is relevant when it was obviously a bad
idea in the first place.
This is like putting rabid weasels in your pants, and later expressing
regret at having chosen those particular rabid weasels and that pair
of pants.
   ---maf