From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geoff Levand Subject: Re: cast truncates bits from constant value (8000000000000000 becomes 0) Date: Fri, 01 Dec 2006 13:17:08 -0800 Message-ID: <45709BD4.80505@am.sony.com> References: <4563D00D.4010704@am.sony.com> <45705D79.6000107@am.sony.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from outbound-blu.frontbridge.com ([65.55.251.16]:13758 "EHLO outbound5-blu-R.bigfish.com") by vger.kernel.org with ESMTP id S1161782AbWLAVRP (ORCPT ); Fri, 1 Dec 2006 16:17:15 -0500 In-Reply-To: Sender: linux-sparse-owner@vger.kernel.org List-Id: linux-sparse@vger.kernel.org To: Linus Torvalds Cc: Geert Uytterhoeven , Linux/PPC Development , linux-sparse@vger.kernel.org, Andrew Pinski Linus Torvalds wrote: > Btw, try this stupid program, to see just how _strange_ gcc enums are.. A > sizeof of the enum is not the same as the size of the individual entries. Yes, interesting. I think your comment regarding compatibility with other compilers is the convincing one. Another way is to change the encoding of the value such that it fits into the range of an enum. For this particular case, the values are actually for a field in the high 3 bits, so I can just do the shift when the value is used. -Geoff