From: Keir Fraser Subject: Re: [PATCH] add canonical address checks to HVM Date: Fri, 01 Dec 2006 11:26:07 +0000 Message-ID: References: <45701B9C.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <45701B9C.76E4.0078.0@novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich , Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >> Is there any guarantee that right-shift is signed when using gcc? > > I suppose so, I believe this is assumed to be that way in various other > places. > However, I'm not sure I have an idea where I could look up implementation > defined behavior for gcc. Looking into it a bit I think a compiler has to be consistent (i.e., it is implementation *defined*) and gcc makes reasonable effort to do signed shifts on architectures that have ISA support for it. I may add a boot-time BUG_ON() just as a sanity check. :-) > Sure, should work too, but would incur more overhead. I was actually trying > to even avoid the two shifts, but I wasn't able to find something that would > use just one *and* would be faster than the version I submitted. I don't think it's possible. Two shifts and a compare is pretty tight. -- Keir > > Jan > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel