Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31857
| From | Marcel Mueller <news.5.maazl@spamgourmet.org> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: elementary loops |
| Date | 2015-06-26 13:39 +0200 |
| Organization | MB-NET.NET for Open-News-Network e.V. |
| Message-ID | <mmjdme$543$1@gwaiyur.mb-net.net> (permalink) |
| References | <loops-20150622181350@ram.dialup.fu-berlin.de> <mmiu9s$pa$1@gwaiyur.mb-net.net> <slrnmoq6pg.uoi.avl@login.logic.tuwien.ac.at> |
On 26.06.15 11.26, Andreas Leitgeb wrote:
>>> { public static void main( final java.lang.String[] args )
>>> { short i = -1;
>>> int j = -1;
>>> for( int k = 0; k < 65; ++k ){ i >>>= 1; j <<= 32; }
>
> The short i is promoted to int, then the MSB ("sign"-bit) zeroed,
> then converted back to short, where it's still -1
In this case the >>> operator is meaningless for short int and there is
no option to perform this operation except for emulating the behavior by
other bit functions or types. The same applies to byte as well.
Of course, this is only another side effect of the missing unsigned types.
Is this guaranteed by the language or just implementation defined?
Marcel
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: elementary loops Marcel Mueller <news.5.maazl@spamgourmet.org> - 2015-06-26 09:17 +0200
Re: elementary loops Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-06-26 09:26 +0000
Re: elementary loops Marcel Mueller <news.5.maazl@spamgourmet.org> - 2015-06-26 13:39 +0200
Re: elementary loops Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-06-26 08:26 -0400
Re: elementary loops Arne Vajhøj <arne@vajhoej.dk> - 2015-06-28 20:12 -0400
Re: elementary loops Marcel Mueller <news.5.maazl@spamgourmet.org> - 2015-06-29 19:50 +0200
Re: elementary loops Arne Vajhøj <arne@vajhoej.dk> - 2015-06-29 13:58 -0400
csiph-web