<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: I&#8217;m a Zero</title>
	<atom:link href="http://www.technicalinterviews.net/im-a-zero/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.technicalinterviews.net/im-a-zero/</link>
	<description>This site features a collection of common technical interview questions gathered by a group of programmers who have been through, and given, lots of technical interviews. There is an emphasis on C++ and game programming technical interviews, but most of the questions are relevant to any technical interview.</description>
	<lastBuildDate>Fri, 07 Oct 2011 20:18:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Man</title>
		<link>http://www.technicalinterviews.net/im-a-zero/comment-page-1/#comment-3704</link>
		<dc:creator>Man</dc:creator>
		<pubDate>Tue, 21 Dec 2010 04:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.technicalinterviews.net/im-a-zero/#comment-3704</guid>
		<description>memset, folks. oneliner.</description>
		<content:encoded><![CDATA[<p>memset, folks. oneliner.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nix</title>
		<link>http://www.technicalinterviews.net/im-a-zero/comment-page-1/#comment-2209</link>
		<dc:creator>Nix</dc:creator>
		<pubDate>Tue, 29 Sep 2009 20:05:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.technicalinterviews.net/im-a-zero/#comment-2209</guid>
		<description>
Why wouldn&#039;t you just do this --

void clearMemory(void *pStartByte, int numBytes)
{
  while ( numBytes-- ) *((char*)pStartBytes) = 0;
}
</description>
		<content:encoded><![CDATA[<p>Why wouldn&#8217;t you just do this &#8211;</p>
<p>void clearMemory(void *pStartByte, int numBytes)<br />
{<br />
  while ( numBytes&#8211; ) *((char*)pStartBytes) = 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodneyk</title>
		<link>http://www.technicalinterviews.net/im-a-zero/comment-page-1/#comment-1685</link>
		<dc:creator>Rodneyk</dc:creator>
		<pubDate>Mon, 04 Feb 2008 19:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.technicalinterviews.net/im-a-zero/#comment-1685</guid>
		<description>Depending on the objective the first solution listed above can be improved.  The first solution does a memory access for every byte of memory being initializes.  However most modern CPUs (80286 and higher for Intel) can access memory at 32 bits or more.  So why waste cycles hitting memory by bytes...


void ClearMemory(void* pStartMem, int numBytes)
{
  unsigned long *plMem = (unsigned long *)pStartMem;
  unsigned char *pcMem = (unsigned char *)pStartMem;
	
  if (pStartMem == NULL)
    return;
  while(numBytes &gt; sizeof(unsigned long))
  {
    *plMem++ = 0;
    numBytes -= sizeof(unsigned long);
  }
  pcMem = (unsigned char *)plMem;
  while(numBytes--)
  {
    *pcMem++ = 0;
  }
}
</description>
		<content:encoded><![CDATA[<p>Depending on the objective the first solution listed above can be improved.  The first solution does a memory access for every byte of memory being initializes.  However most modern CPUs (80286 and higher for Intel) can access memory at 32 bits or more.  So why waste cycles hitting memory by bytes&#8230;</p>
<p>void ClearMemory(void* pStartMem, int numBytes)<br />
{<br />
  unsigned long *plMem = (unsigned long *)pStartMem;<br />
  unsigned char *pcMem = (unsigned char *)pStartMem;</p>
<p>  if (pStartMem == NULL)<br />
    return;<br />
  while(numBytes &gt; sizeof(unsigned long))<br />
  {<br />
    *plMem++ = 0;<br />
    numBytes -= sizeof(unsigned long);<br />
  }<br />
  pcMem = (unsigned char *)plMem;<br />
  while(numBytes&#8211;)<br />
  {<br />
    *pcMem++ = 0;<br />
  }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kiklop</title>
		<link>http://www.technicalinterviews.net/im-a-zero/comment-page-1/#comment-17</link>
		<dc:creator>kiklop</dc:creator>
		<pubDate>Sat, 30 Dec 2006 17:59:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.technicalinterviews.net/im-a-zero/#comment-17</guid>
		<description>
void clearMemory(void *pStartByte, int numBytes) {
 if (pStartByte == NULL) {
   return;
 }
 char* buffer = (char*)pStartByte;
 while (numBytes--) {
   *buffer++ = &#039;&#039;;
 }
}
</description>
		<content:encoded><![CDATA[<p>void clearMemory(void *pStartByte, int numBytes) {<br />
 if (pStartByte == NULL) {<br />
   return;<br />
 }<br />
 char* buffer = (char*)pStartByte;<br />
 while (numBytes&#8211;) {<br />
   *buffer++ = &#8221;;<br />
 }<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

