<?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: Interrupt Safe Ring Buffer Library</title>
	<atom:link href="http://steve.kargs.net/software/interrupt-safe-ring-buffer-library/feed/" rel="self" type="application/rss+xml" />
	<link>http://steve.kargs.net/software/interrupt-safe-ring-buffer-library/</link>
	<description>Open Source Software Haven</description>
	<lastBuildDate>Mon, 16 Jan 2012 07:36:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Lei</title>
		<link>http://steve.kargs.net/software/interrupt-safe-ring-buffer-library/comment-page-1/#comment-82773</link>
		<dc:creator>Lei</dc:creator>
		<pubDate>Fri, 01 Jul 2011 23:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://steve.kargs.net/?p=116#comment-82773</guid>
		<description>The absolute index method only wraps around then the buffer size is a divisor of the counter&#039;s capacity. So if the buffer size is a power of two and a unsigned integer counter is used, the counter would always wrap around.</description>
		<content:encoded><![CDATA[<p>The absolute index method only wraps around then the buffer size is a divisor of the counter&#8217;s capacity. So if the buffer size is a power of two and a unsigned integer counter is used, the counter would always wrap around.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: skarg</title>
		<link>http://steve.kargs.net/software/interrupt-safe-ring-buffer-library/comment-page-1/#comment-69091</link>
		<dc:creator>skarg</dc:creator>
		<pubDate>Sat, 08 Jan 2011 13:44:03 +0000</pubDate>
		<guid isPermaLink="false">http://steve.kargs.net/?p=116#comment-69091</guid>
		<description>Hi Joaquim,

head minus tail will only return zero when they are equal, which is the only time that the buffer is empty,  even if the value of head reaches the maximum value of an unsigned integer.

The concept is exploiting unsigned integer overflow in C:
http://en.wikipedia.org/wiki/Integer_overflow
&quot;In the C programming language, signed integer overflow causes undefined behavior, while unsigned integer overflow causes the number to be reduced modulo a power of two, meaning that unsigned integers &quot;wrap around&quot; on overflow. &quot;

There is more discussion of the various types of Circular Buffers at Wikipedia from the link in the article:
http://en.wikipedia.org/wiki/Circular_buffer

Best Regards,

Steve</description>
		<content:encoded><![CDATA[<p>Hi Joaquim,</p>
<p>head minus tail will only return zero when they are equal, which is the only time that the buffer is empty,  even if the value of head reaches the maximum value of an unsigned integer.</p>
<p>The concept is exploiting unsigned integer overflow in C:<br />
<a href="http://en.wikipedia.org/wiki/Integer_overflow" rel="nofollow">http://en.wikipedia.org/wiki/Integer_overflow</a><br />
&#8220;In the C programming language, signed integer overflow causes undefined behavior, while unsigned integer overflow causes the number to be reduced modulo a power of two, meaning that unsigned integers &#8220;wrap around&#8221; on overflow. &#8221;</p>
<p>There is more discussion of the various types of Circular Buffers at Wikipedia from the link in the article:<br />
<a href="http://en.wikipedia.org/wiki/Circular_buffer" rel="nofollow">http://en.wikipedia.org/wiki/Circular_buffer</a></p>
<p>Best Regards,</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joaquim Torres</title>
		<link>http://steve.kargs.net/software/interrupt-safe-ring-buffer-library/comment-page-1/#comment-10991</link>
		<dc:creator>Joaquim Torres</dc:creator>
		<pubDate>Mon, 27 Apr 2009 16:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://steve.kargs.net/?p=116#comment-10991</guid>
		<description>What happens when head reaches the max value of an int and returns to zero? I think inuse() will return a wrong value.</description>
		<content:encoded><![CDATA[<p>What happens when head reaches the max value of an int and returns to zero? I think inuse() will return a wrong value.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

