From owner-svn-src-head@FreeBSD.ORG Tue Aug 26 14:41:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C037A43; Tue, 26 Aug 2014 14:41:24 +0000 (UTC) Received: from mail-oa0-x235.google.com (mail-oa0-x235.google.com [IPv6:2607:f8b0:4003:c02::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE9B13F40; Tue, 26 Aug 2014 14:41:23 +0000 (UTC) Received: by mail-oa0-f53.google.com with SMTP id j17so11979187oag.40 for ; Tue, 26 Aug 2014 07:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OO/9O9c5ALwPvGCtajtihiu6CknoGzle3WcLD+iNQ9Y=; b=bRimdE0oFNGGefzv75v3p3Y3cDLrNot+h+NrsQ6pkkXchqCUAIK1xt7Q1CWNUWGPSU LqdtNxOTT7sAjGodMfTPTmDjzI6W0+nA/la2PmnbrQuIDr161pjBNQyBtSb9nG/2VWcn HFci/aIFvAXSJVDSkD5IMYbaXmbW+RdN6Xgij4eSkI3PphUYaLWgV9QqhalmYMrcVzHY FvZANVwhshfdyvZGfKjTqJHN5Y0c3uoTFrKgol1sQLV1M2yuXSV7CvoGZyWwnEmqZmKf J/t2A1tek3GTa3t9fqGVk7SboPq+DTBHwjCFS4GocFJU7suaWq3DYFBfwrQQH5XVaGx/ +OfA== MIME-Version: 1.0 X-Received: by 10.182.241.200 with SMTP id wk8mr28009491obc.27.1409064083171; Tue, 26 Aug 2014 07:41:23 -0700 (PDT) Received: by 10.182.98.111 with HTTP; Tue, 26 Aug 2014 07:41:23 -0700 (PDT) In-Reply-To: <20140826233018.H32188@besplex.bde.org> References: <201408201632.s7KGW2vF093636@svn.freebsd.org> <20140826233018.H32188@besplex.bde.org> Date: Tue, 26 Aug 2014 10:41:23 -0400 Message-ID: Subject: Re: svn commit: r270227 - head/sys/sys From: Benjamin Kaduk To: Bruce Evans Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Aug 2014 14:41:24 -0000 On Tue, Aug 26, 2014 at 9:58 AM, Bruce Evans wrote: > > That would be a further obfuscation. The *INTC() macros expand to > integer constant expressions of the specified type suitable for use > in #if preprocessing directives. (It is otherwise difficult to > detemine the correct suffix, to add to the constant to give it the > specified type). There are no preprocessing directives here, so a > simple cast works. The cast could also be applied to the other > operand but it is easier to read when applied to the constant. > I thought that in C99, all integers in preprocessor evaluation were treated as if they were [u]intmax_t (6.10.1.4 in the n1256.pdf I have here). I was only just skimming that part yesterday for unrelated reasons, though, so maybe I'm missing the bigger picture. > The expression could also be written without a cast and without using > UINT64_C(), by using a 'ULL' suffix instead of 'LL'. That would still > use the long long abomination, and be different obfuscation -- the > type of the constant doesn't really matter, but we need to promote > to the type of 'frac', that is, uint64_t. 'ULL' works because long > longs are at least 64 bits (and I think unsigned long longs are also > 2's complemention, so their type is larger than uint64_t. Two's complement semantics are guaranteed for the fixed width types such as int64_t, but I'm not sure how that comes into play for unsigned types? -Ben