<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Meseret Gebre &#187; Optimize</title>
	<atom:link href="http://meseretgebre.com/archives/tag/optimize/feed/" rel="self" type="application/rss+xml" />
	<link>http://meseretgebre.com</link>
	<description></description>
	<lastBuildDate>Fri, 04 Jun 2010 07:15:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>High Performance Distributed Computing</title>
		<link>http://meseretgebre.com/archives/high-performance-distributed-computing/</link>
		<comments>http://meseretgebre.com/archives/high-performance-distributed-computing/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 03:12:22 +0000</pubDate>
		<dc:creator>mez</dc:creator>
				<category><![CDATA[HPDC]]></category>
		<category><![CDATA[Optimize]]></category>

		<guid isPermaLink="false">http://meseretgebre.com/?p=20</guid>
		<description><![CDATA[High performance distributed computing also known as HPDC is the effective development and use of software on distributed memory supercomputing clusters. Developing code that is optimized is a challenging task for many reasons. One issue is the semantic gap between the processor and the language you choose to develop with. The higher abstract the language, [...]]]></description>
			<content:encoded><![CDATA[<p>High performance distributed computing also known as HPDC is the effective development and use of software on distributed memory supercomputing clusters. Developing code that is optimized is a challenging task for many reasons. One issue is the semantic gap between the processor and the language you choose to develop with. The higher abstract the language, the less performance you realize from the processor. Also often the resources of cluster computing are under utilized. This is because it is challenging to extract area of code that can be run concurrently. Most of the time jobs are run in serial. </p>
<p>I have big interest in HPDC and this section of my blog is all about HPDC. Most of my examples are with C unless stated otherwise. I hope you learn from this section and don&#8217;t hesitate to ask questions! </p>
]]></content:encoded>
			<wfw:commentRss>http://meseretgebre.com/archives/high-performance-distributed-computing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bitwise Operators</title>
		<link>http://meseretgebre.com/archives/bitwise-operators/</link>
		<comments>http://meseretgebre.com/archives/bitwise-operators/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 02:48:21 +0000</pubDate>
		<dc:creator>mez</dc:creator>
				<category><![CDATA[HPDC]]></category>
		<category><![CDATA[Bitwise operators]]></category>
		<category><![CDATA[Optimize]]></category>

		<guid isPermaLink="false">http://meseretgebre.com/?p=8</guid>
		<description><![CDATA[Bitwise operators let you manipulate individual bits. Normally I would not bother writing about this, but I believe knowing about bit wise operation is an important asset to have when trying to optimize code. Especially in memory consumption. Keep in mind that all bitwise operations  in C only work of singed and unsigned integer primitive [...]]]></description>
			<content:encoded><![CDATA[<p>Bitwise operators let you manipulate individual bits. Normally I would not bother writing about this, but I believe knowing about bit wise operation is an important asset to have when trying to optimize code. Especially in memory consumption. Keep in mind that all bitwise operations  in C only work of singed and unsigned integer primitive data types, mainly:</p>
<ol>
<li>char</li>
<li>short</li>
<li>int</li>
<li>long</li>
</ol>
<p><strong>Article outline</strong><br />
I&#8217;ll talk about each of the following operations and give some examples on how to use each.</p>
<ol>
<li>Bitwise NOT (~)</li>
<li>Bitwise AND (&amp;)</li>
<li>Bitwise OR (|)</li>
<li>Bitwise XOR (^)</li>
<li>Shift Left (&lt;&lt;)</li>
<li>Shift Right(&gt;&gt;)</li>
</ol>
<p><strong>Bitwise NOT (~)</strong><br />
This is an unary operator. It simply filps all &#8216;0&#8217;s to &#8216;1&#8217;s and &#8216;1&#8217;s to &#8216;0&#8217;s. Here is a simple example:</p>
<pre class="brush: c">
unsigned byte x = 10;
x = 00001010
~x = 11110101
</pre>
<p><strong>Bitwise AND (&amp;)</strong><br />
This is a binary operator. Just follow the truth table. Both bits have to be true to get a resulting true bit. Anything else is false. Here is a simple example:</p>
<pre class="brush: c">
unsigned byte x = (10&amp;8);
10  = 00001010
8   = 00001000
x   = 00001000
</pre>
<p><strong>Bitwise OR (|)</strong><br />
This is a binary operator. Just follow the truth table. Here, just one of the bits has to be true to get a resulting true. Here is a simple example:</p>
<pre class="brush: c">
unsigned byte x = (10|8);
10  = 00001010
8   = 00001000
x   = 00001010
</pre>
<p style="text-align: left;"><strong>Bitwise XOR (^)</strong><br />
This is a binary operator. Just follow the truth table. Basically it flags all bits that are different. Here is a simple example:</p>
<pre class="brush: c">
unsigned byte x = (10^15);
10  = 00001010
15  = 00001111
x   = 00000101
</pre>
<p><strong>Shift Left (&lt;&lt;)</strong><br />
Keep in mind that when you do one of the shift operators the size of the data type does not change.<br />
A left shift, moves the bits to the left inserting &#8216;0&#8217;s in the right most bit for every shift. The left most bit is discarded. This is effectively multiplying the number by 2. Note if you use too many shifts you could end up with a negative number. This is possible if the data type is interpreted as 2&#8217;s complement. Here is a simple example:</p>
<pre class="brush: c">
unsigned byte x = 4 &lt;&lt; 2;
4   = 00000100
x   = 00010000
x = 16
</pre>
<p><strong>Shift Right (&gt;&gt;)</strong><br />
A rightshift, moves the bits to the right inserting &#8216;0&#8217;s in the left most bit for every shift. The right most bit is discarded. This is effectively dividing the number by 2. Note if you use too many shifts you could end up with a zero. Here is a simple example:</p>
<pre class="brush: c">
unsigned byte x = 4 &gt;&gt; 2;
4   = 00000100
x   = 00000001
x = 1
</pre>
<p>That wraps up the bitwise operators. If there is anything I forgot, let me know and I&#8217;ll make the updates. I hope you learned something in this read. Remember these are operation which the processor can execute very fast. For example, if you every need to multiple or divide by 2, it best to use the shift operations. Not only will you code execute faster, but also save you processor some energy!</p>
]]></content:encoded>
			<wfw:commentRss>http://meseretgebre.com/archives/bitwise-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
