<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Tips and tricks for bitwise arithmetic</title>
	<link>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/</link>
	<description>Stay curious!</description>
	<pubDate>Fri, 29 Aug 2008 05:08:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: salman</title>
		<link>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-14220</link>
		<author>salman</author>
		<pubDate>Fri, 15 Feb 2008 22:14:47 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-14220</guid>
		<description>by the way nice article.</description>
		<content:encoded><![CDATA[<p>by the way nice article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salman</title>
		<link>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-14219</link>
		<author>salman</author>
		<pubDate>Fri, 15 Feb 2008 22:14:06 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-14219</guid>
		<description>i would wish you would write the following line

 sum(o.valid = 1 * i.value) as valid_value,

as

 sum((o.valid = 1) * i.value) as valid_value,

because for some programming lang '*' 
has greater precedence than '='.
the expression becomes 

 sum(o.valid = (1 * i.value)) as valid_value,
it just seems confusing.

P.S. if i put my foot in mouth, just give me a shout.</description>
		<content:encoded><![CDATA[<p>i would wish you would write the following line</p>
<p> sum(o.valid = 1 * i.value) as valid_value,</p>
<p>as</p>
<p> sum((o.valid = 1) * i.value) as valid_value,</p>
<p>because for some programming lang &#8216;*&#8217;<br />
has greater precedence than &#8216;=&#8217;.<br />
the expression becomes </p>
<p> sum(o.valid = (1 * i.value)) as valid_value,<br />
it just seems confusing.</p>
<p>P.S. if i put my foot in mouth, just give me a shout.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salman</title>
		<link>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-14218</link>
		<author>salman</author>
		<pubDate>Fri, 15 Feb 2008 22:09:53 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-14218</guid>
		<description>set @bitset = case when @number &#38; @bit  0 then 1 else 0 end; — bad!
set @bitset = (@number &#38; @bit) / @bit; — good!


could these also be written as


set @bitset = ((@number &#38; @bit) = @bit); — better? we avoid an expensive division.


Is there any particular reason for the division?</description>
		<content:encoded><![CDATA[<p>set @bitset = case when @number &amp; @bit  0 then 1 else 0 end; — bad!<br />
set @bitset = (@number &amp; @bit) / @bit; — good!</p>
<p>could these also be written as</p>
<p>set @bitset = ((@number &amp; @bit) = @bit); — better? we avoid an expensive division.</p>
<p>Is there any particular reason for the division?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Curran</title>
		<link>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-4613</link>
		<author>James Curran</author>
		<pubDate>Mon, 26 Feb 2007 17:18:29 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2005/09/28/bitwise-arithmetic/#comment-4613</guid>
		<description>&lt;p&gt;It should be noted that "if (number &#038; mask != 0)"  is merely "confusing,  Bad practice!" only if mask represent a single bit of mutually exclusive flags.

If "mask" can have several bits set, then it's just plain wrong.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>It should be noted that &#8220;if (number &#038; mask != 0)&#8221;  is merely &#8220;confusing,  Bad practice!&#8221; only if mask represent a single bit of mutually exclusive flags.</p>
<p>If &#8220;mask&#8221; can have several bits set, then it&#8217;s just plain wrong.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
