EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Bug on Pentium IOC
From: Eric Norum <[email protected]>
To: Dirk Zimoch <[email protected]>
Cc: Bernd Schoeneburg <[email protected]>, TECHTALK <[email protected]>
Date: Tue, 17 Dec 2002 08:38:54 -0600

On Tuesday, December 17, 2002, at 06:40 AM, Dirk Zimoch wrote:




Bernd Schoeneburg wrote:
Hi all,
can anyone explain this:
~(~0UL << 32)        is 0xFFFFFFFF on a Motorola VME162 i.e., which is
correct
                                the same on a Pentium is 0, which is
false!
Ideas?
Bernd

The Pentium (and all Intel x86s, I think) does all shifts mod 32. Thus (~0 << 32) is not shifted at all. => ~(~0 << 32) = ~~0 = 0

There may be other architectures that behave similar.

From the C standard description of the shift operators: ``The result is undefined if the right operand is negative, or greater than or equal to the number of bits in the left expression's type.
Since 0UL is 32 bits on both the M68k and I386 architectures, the above expression is undefined and the compiler is free to do anything it wants.
The only bug here is in the code -- not on the Pentium nor in the compiler.


--
Eric Norum <[email protected]>
Department of Electrical Engineering
University of Saskatchewan
Saskatoon, Canada.
Phone: (306) 966-5394   FAX:   (306) 966-5407


References:
Re: Bug on Pentium IOC Dirk Zimoch

Navigate by Date:
Prev: Re: Bug on Pentium IOC Dirk Zimoch
Next: Re: my base download account cann't use M.C.Shao
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Bug on Pentium IOC Dirk Zimoch
Next: some JOImint for xmas Matthias Clausen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·