Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Java left shift and right shift operators. Date: Tue, 26 Apr 2011 09:49:24 -0400 Organization: albasani.net Lines: 32 Message-ID: References: <295e16b3-2ed8-4529-bfb0-1cc26ed93ad6@d26g2000prn.googlegroups.com> <188cz6ta97kkm$.dlg@kimmeringer.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net /QspSo1Wc0WW6M5wuTUyi1FLfrFQpfwEa9ezTi2AxFa52nyWd5CtsPazSXU+hFGY+oUS7samtXbQxy2oBaJJg5CxGuoyajAmMSx1HNLld683Rq2M4/96C0dIa4xGbUlS NNTP-Posting-Date: Tue, 26 Apr 2011 13:49:18 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="nvwEmDbl+XX77ekYag2MLa0zqGlrRZdtgUPAcOyM1VJVtQX6JsruBe5LLRhFT5HrzG4wkyuEv3Y9qEnfz+k3yaWTD4jrHurBwvFaXOC2qVmH3hHfPf/+EWI0M5uXfytm"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: <188cz6ta97kkm$.dlg@kimmeringer.de> Cancel-Lock: sha1:dobUgvw3IdrQp3jEb820Ca5VPAw= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3261 Lothar Kimmeringer wrote: > Sanny wrote: > >> I have a problem where I have to do left shift and right shift. >> > [...] >> >> I have to use use left shift and right shift to shift Number right/ >> left depending on value of shiftby >> >> if (shift>0) output = N>> shiftby; else output = N<< (-shiftby);// >> working but inefficient. > In what way is it inefficient? Have you performed measurements > or do you simply think that it's slow and want to optimize > it prematurely? Sanny-Boy, I see that you posted after Lothar asked you this very, very important question but that you did not answer this question. This is a conversation, not a bunch of lackeys leaping to your bid. Please answer the questions. You claim inefficiency in something you have no clue whatsoever to be inefficient. Here's another question, assuming you answer Lothar's question at all, if you did perform measurements, what were the results? -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg