Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7986
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "Bo Persson" <bop@gmb.dk> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: Unexpected Rotate? |
| Date | Tue, 19 Jul 2011 23:52:34 +0200 |
| Lines | 44 |
| Message-ID | <98mcktFgofU1@mid.individual.net> (permalink) |
| References | <QziVp.6100$NP6.826@news.usenetserver.com> <9q6dnT4jI5l2f7jTnZ2dnUVZ8j6dnZ2d@eclipse.net.uk> |
| X-Trace | individual.net RXwKbJpZiyFw/3JEpTyT/gZi0GHi9ObTPGQhtBAVQMnbAGPCKj |
| Cancel-Lock | sha1:0cXyuJKGMp6GqhMqRHpGkI/LO84= |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5931 |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.6109 |
| X-RFC2646 | Format=Flowed; Response |
| X-Antivirus | avast! (VPS 110719-1, 2011-07-19), Outbound message |
| X-Antivirus-Status | Clean |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:7986 |
Show key headers only | View raw
Andy Champ wrote: > On 19/07/2011 17:48, Michael D. Berger wrote: >> With: >> g++ --version >> g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48) >> >> On: >> uname -a >> Linux mbrc40 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST >> 2011 i686 i686 i386 GNU/Linux >> (A Centos box) >> >> Running the program: >> uint64_t mask = 0x8000000000000000ULL; >> cout<< "mask = 0x"<< hex<< mask<< endl; >> cout<< "mask>>63 = 0x"<< hex<< (mask>>63)<< endl; >> cout<< "mask>>64 = 0x"<< hex<< (mask>>64)<< endl; >> >> I get: >> mask = 0x8000000000000000 >> mask>>63 = 0x1 >> mask>>64 = 0x8000000000000000 >> >> Why is the final value not: 0x0 ? >> >> Thanks for your comments. >> Mike. > > Some architectures only use the bottom bits of the shift value. So > it's effectively 64 AND 63, AKA zero. > > I'd look it up, but the manual is at work... > The language standard says its undefined, because different hardware implement it differently. The reason for the masking is that actually shifting billions of times (mask >> 0xFFFFFFFFFFFFF) would give an awful interrupt latency. Bo Persson
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