Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!xlned.com!feeder3.xlned.com!multikabel.net!newsfeed10.multikabel.net!feeder2.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!216.196.98.146.MISMATCH!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news1 From: Michael Wojcik Newsgroups: comp.lang.java.programmer Subject: Re: boolean to int : was char to decimal Date: Tue, 10 May 2011 11:02:01 -0400 Organization: Micro Focus Lines: 22 Message-ID: References: <92ea64F3avU1@mid.individual.net> NNTP-Posting-Host: pd84922ddae7c53dce50da8a0628ef8938d358edd23798088.newsdawg.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.5.0 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3919 Lawrence D'Oliveiro wrote: > In message , Michael Wojcik wrote: > >> switch (((d2 > curve_collinearity_epsilon) << 1) + >> (d3 > curve_collinearity_epsilon)) { >> >> I would have preferred binary-or there rather than addition, for >> clarity, but either works. > > Using the bitwise operator allows you to remove some parentheses. True. (In C, addition has higher precedence than bit-shift, but bitwise-or has lower precedence than bit-shift.) Whether that makes the overall expression easier to read is a subjective question, but I'd probably go with removing the unnecessary parentheses, particularly with the two subexpressions on separate lines (assuming we keep the formatting). -- Michael Wojcik Micro Focus Rhetoric & Writing, Michigan State University