Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7996
| From | Bart van Ingen Schenau <bart@ingen.ddns.info> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Unexpected Rotate? |
| Date | 2011-07-20 10:41 +0200 |
| Organization | No organisation in particular |
| Message-ID | <j064bt$1e6$1@localhost.localdomain> (permalink) |
| References | <QziVp.6100$NP6.826@news.usenetserver.com> <j04d35$20ht$1@news.ett.com.ua> <wrnVp.66368$fl.60334@newsfe23.ams2> |
Paul Wrote: > > "Balog Pal" <pasa@lib.hu> wrote in message > > news:j04d35$20ht$1@news.ett.com.ua... > > "Michael D. Berger" <m_d_berger_1900@yahoo.com> > >> uint64_t mask = 0x8000000000000000ULL; > >> cout << "mask>>64 = 0x" << hex << (mask>>64) << endl; > >> > >> I get: > >> mask>>64 = 0x8000000000000000 > >> > >> Why is the final value not: 0x0 ? > > > > the second operand of shift must be 0 <= op < bits. Otherwise > > behavior is > > undefined. For your case 63 is the maximum legal value. (lazi to > > quote > > the stadard, but it is there right in the first point. > > > So what if its undefined? > Does that mean it;s impossible? It means that the combination of compiler & CPU can do anything it likes and it does not even have to be consistent about it. The most likely results in this case are: - The top bits of the shift-value are ignored (this is done, for example, by x86 CPUs) - The operator results in the value 0 Bart v Ingen Schenau
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unexpected Rotate? "Michael D. Berger" <m_d_berger_1900@yahoo.com> - 2011-07-19 16:48 +0000
Re: Unexpected Rotate? "Balog Pal" <pasa@lib.hu> - 2011-07-19 18:58 +0200
Re: Unexpected Rotate? "Paul" <pchristor@yahoo.co.uk> - 2011-07-19 23:20 +0100
Re: Unexpected Rotate? Bart van Ingen Schenau <bart@ingen.ddns.info> - 2011-07-20 10:41 +0200
Re: Unexpected Rotate? Leigh Johnston <leigh@i42.co.uk> - 2011-07-19 18:00 +0100
Re: Unexpected Rotate? Andy Champ <no.way@nospam.invalid> - 2011-07-19 21:02 +0100
Re: Unexpected Rotate? "Bo Persson" <bop@gmb.dk> - 2011-07-19 23:52 +0200
Re: Unexpected Rotate? James Kanze <james.kanze@gmail.com> - 2011-07-20 12:57 -0700
Re: Unexpected Rotate? "Michael D. Berger" <m_d_berger_1900@yahoo.com> - 2011-07-21 02:10 +0000
Re: Unexpected Rotate? "Balog Pal" <pasa@lib.hu> - 2011-07-21 11:10 +0200
Re: Unexpected Rotate? Andy Champ <no.way@nospam.invalid> - 2011-07-21 20:35 +0100
Re: Unexpected Rotate? James Kanze <james.kanze@gmail.com> - 2011-07-22 10:33 -0700
csiph-web