220 35586 <3058817.kvbDme98ge@tjmaciei-mobl1> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Rotational shift operator
Date: Tue, 28 Nov 2017 17:33:24 -0800
Lines: 40
Approved: news@gmane.org
Message-ID: <3058817.kvbDme98ge@tjmaciei-mobl1>
References: <69593098-e2cc-487e-bd14-9001b27aa7c1@isocpp.org> <CAHSYqda2VTVT4Qid7GC9vzPxEKSDdmHxC9QR7EEoBtxzU6OZSQ@mail.gmail.com> <6888287.JoKhHhR3xM@tjmaciei-mobl1>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1511919208 24920 195.159.176.226 (29 Nov 2017 01:33:28 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 29 Nov 2017 01:33:28 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBZU47DIAKGQEFAT5Z6Q@isocpp.org Wed Nov 29 02:33:24 2017
Return-path: <std-proposals+bncBCB4TK757YBRBZU47DIAKGQEFAT5Z6Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qt0-f199.google.com ([209.85.216.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB4TK757YBRBZU47DIAKGQEFAT5Z6Q@isocpp.org>)
	id 1eJrFY-0005wj-NT
	for gclcip-std-proposals@m.gmane.org; Wed, 29 Nov 2017 02:33:20 +0100
Original-Received: by mail-qt0-f199.google.com with SMTP id z37sf1276118qtz.16
        for <gclcip-std-proposals@m.gmane.org>; Tue, 28 Nov 2017 17:33:28 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1511919206; cv=pass;
        d=google.com; s=arc-20160816;
        b=ilJj809KYyiBu3V1S/KGm4moiHO9HLUSqjsBHBjlaieTZmqoT5U+NnOlL9stNhAXa/
         ZHiShn988mSQcZCbMDVojRlTdb6dLQdJwEt/8fYWLkgnudyHEWJINfpI1ehIYBb+rB4b
         0rKyDPh5+okIPBB0OK5jWqHmu3i7TCsQtKxUBxzQPZAy/fRRB0DW5p/1UaKw2BoMI38w
         W+qUUl4ENKD+9uEemDhr2kBVNsvRf9VmZXh3b7rarBKlXDO65X7igp6aF7C3qmi2tS1y
         QCFLMjxY1oFOcmJ5DmfS67LIRk6MlChUSrgSzMYIe2c9twNqm5df5n/7c1Grd4T7kgAt
         kIlg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:mime-version:references
         :in-reply-to:message-id:date:subject:to:from
         :arc-authentication-results:arc-message-signature:dkim-signature
         :arc-authentication-results;
        bh=4LsadhHVyU3B7H/rV9b84LoQPiw37O6PqOtgKrrFd2o=;
        b=LGrXd1XSpQDoCZ/hV0NnsgCnQ58l1Wqx4Xf1e7EFSzM5vXyPHT4XdOPf1qO/zGRcrn
         Rbwt0oszlxbI58NxwXt5ZLKCImEk3pNEf+bd3x7zeQbhMYLvj6fTzrDgOaRZ5y2yigFd
         dd0y5XoAhJ6LIhlUxEmpT6GUEIjyTkFbbOX0Ai5WCdI3RPRVZNMiUYcToHs8rYFXO8iJ
         4WgyQlshEfMEA2rr/Y6UJj6ZTnmxerGIvECZ8DTOzBYZUtTwPD/7Z+vEXQ4vCovGSWY4
         fvjWvL8h2cra2e/aiA8yeh5JggOoiTQ1zECrFc/qFySWh8ycU9UpSWmQgd82RP55BEh8
         9bwQ==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of thiago@macieira.org designates 2001:19f0:5:2221::1:3 as permitted sender) smtp.mailfrom=thiago@macieira.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:in-reply-to:references:mime-version
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=4LsadhHVyU3B7H/rV9b84LoQPiw37O6PqOtgKrrFd2o=;
        b=XWzRwD1F9mqn/wKYGp5l4QZzGYcSfC9VeD9WKQwh+MoXg8BTJsf6u3mtklFUiAtN4g
         1gpFpITVzqyuDy7AxHFvMH9saBCdQgK5bvpRsVX+eai5HqWLMcN43oZqlaRe/uoH2q8j
         fIstFL7ZAFLH/VK1utf78AhAKMAMTsNFj7tPYmJexdMywhK1KWoyOikTFohz9OMgRb/X
         MrAIhPfnH/4Dqz6Jvt92bqmYX9Ls2xMfgDOCpYw23zumHgKog7rBWzynn32kBSFQYQ5c
         BqH9qDD70z2Q2Nqh4pi0ueJfB23Fuwj56fASN7mKr/bBOx6EcEeFivOdfSm/VSTggnsT
         4uaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
         :references:mime-version:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=4LsadhHVyU3B7H/rV9b84LoQPiw37O6PqOtgKrrFd2o=;
        b=dShyOJKjkrT/n29qaccAnCJLLbyDVqvREwBQVVy3qLb4uWEBaOGDSt+efTZbfoMAHx
         +MwenUlhQnUVCZNw51iw39tmaznEWr1iOrQMec+ybF6Q2oSUWhIuq8S0J1DKlF3Hi2LW
         Q+ocz1G5Jcy3AXutNIF1XCxIGQGQIXNoZT8MZjqccSB087VKVQqd/2k8vAmriMH0yAzF
         c6/cChKgQC+Ndppicq10q4XU8Q2NcrffhB9lhCrcC2iaqtSbSR11Gn5NjiAQICuc1jVP
         nWy7ujpDFWfT1/Fmw8Nac6bjRdOIv5oWVOfKX/xEhrTDkuRyLvBdM6h3Oe37nAg5sRbd
         3Edg==
X-Gm-Message-State: AJaThX7C3jnOpuaAQIIHKydzK5y3zFRnad47JHZiKkvRHOONFY7ZnDt5
	9njf8BGET9eDLTLlmHTb/12Uug==
X-Google-Smtp-Source: AGs4zMbx1ULC7lBMSozQREAYOLAnNGKnsfWkBlsl1idV9zxtadwMwAce3nvkC0sgnF1PFbeFaQbAOw==
X-Received: by 10.200.37.157 with SMTP id e29mr838492qte.40.1511919206636;
        Tue, 28 Nov 2017 17:33:26 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.237.62.110 with SMTP id m43ls10282285qtf.6.gmail; Tue, 28 Nov
 2017 17:33:26 -0800 (PST)
X-Received: by 10.200.3.234 with SMTP id z42mr2121937qtg.25.1511919206029;
        Tue, 28 Nov 2017 17:33:26 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1511919205; cv=none;
        d=google.com; s=arc-20160816;
        b=VQoM1ngoxk8lJP0z/6eXA1N96cAzrbkqInFiPET994osLAQy8K2im4TLCYS9qB3K2M
         1QM2S0CYGOPTU2gMWwT3bkOpMcr1QJfWnM4SS5vtKtwhiJCJbluDuLzthP/93mllnJtW
         0AeigM/+sh+foTZ24Rlc1o9WXUMie2liUy5IINPC6JidgI5xKEIR5B2l1yW/J8qLqgdU
         ym86Fej6EGb52X8fz8spFdZ6XnvlnqTzrGirfUJ4p8mHXapvGVr2JTc0rW45p1YMpVJL
         H3ijmDAd/KO/qLdxpN3/tIwhU8xuyY6eeMNbDzwLGhxn/dfaRkfSYRzOU3ZvtTuJW3JV
         hRyw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:to:from:arc-authentication-results;
        bh=QExW23FmfCrqFWdDbMUC6EZvR+QRW/mdQBvoUM3LuDY=;
        b=IZDgkkPNSZ0bq37JfrU2cnm8J4MR2oNnJIgWaRcLrnkrpYnZOQU8MKTTvv6mQh0M8/
         UWJ7e1vktJLyqkzjiRC22uG8ufwFxgpgmBLXOOawRi45P+NeLBkwq1bd1Zu7KeAoBsdh
         YMdOhyN5VXE9uo9/h0Orm/Mvri+aGLOgpVfEiPJSUER3t9BCT9bptcl2TX9CvndxGuLs
         53MJrze0umWUQOJMrDN5MrF2LNvIiYctWS3WzjyvSJ5DSpsQaZAxyf8nMkntLlFVGNOt
         ryyHqn2kBbnM2GfNdhmVTCmMegLYlsdfQuYdS4mpX5aBf12f1vZ9k8M4JNpfndgR4Dkb
         HDAQ==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of thiago@macieira.org designates 2001:19f0:5:2221::1:3 as permitted sender) smtp.mailfrom=thiago@macieira.org
Original-Received: from smtp.macieira.info (smtp.macieira.info. [2001:19f0:5:2221::1:3])
        by mx.google.com with ESMTPS id y9si601652qtf.388.2017.11.28.17.33.25
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 28 Nov 2017 17:33:25 -0800 (PST)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 2001:19f0:5:2221::1:3 as permitted sender) client-ip=2001:19f0:5:2221::1:3;
Original-Received: from tjmaciei-mobl1.localnet (fmdmzpr03-ext.fm.intel.com [192.55.54.38])
	by smtp.macieira.info (Postfix) with ESMTPSA id 52F562C5F
	for <std-proposals@isocpp.org>; Tue, 28 Nov 2017 17:33:25 -0800 (PST)
In-Reply-To: <6888287.JoKhHhR3xM@tjmaciei-mobl1>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 2001:19f0:5:2221::1:3 as permitted
 sender) smtp.mailfrom=thiago@macieira.org
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:35586
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35586>

On Tuesday, 28 November 2017 17:27:03 PST Thiago Macieira wrote:
> What should, according to you, the following produce:
> 
>         1U << functionThatReturns33();
> 
> Please answer bearing in mind that the SHL operation in assembly is only
> specified to work with values less than 32. Any higher value may shift
> everything, nothing, or shift by the modulo 32.

Please answer in two cases:

 1) regular context, the compiler could not inline functionThatReturns33()

 2) constant expression context, the compiler can inline and did constant 
propagation

in other words:

$ cat a.cpp
extern int functionThatReturns33();
unsigned u1 = 1U << functionThatReturns33();

$ cat b.cpp
constexpr int constexpr33() { return 33; }
int functionThatReturns33() { return constexpr33(); }

constexpr unsigned u2 = 1U << constexpr33();

What are the values of u1 and u2, according to you?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3058817.kvbDme98ge%40tjmaciei-mobl1.

.
