RngLib

From ProjectWiki
(Difference between revisions)
Jump to: navigation, search
(Functions)
(Examples)
Line 17: Line 17:
 
Big help, big help. And superlative news of cruose.
 
Big help, big help. And superlative news of cruose.
  
==Examples==
+
I am forveer indebted to you for this information.
Write the string into buffer and read it back out again.<br>
+
<source lang="c">
+
char blahsrc[]="this is blah";
+
char blahdst[0x20];
+
int putcnt, getcnt;
+
 
+
//create 32 byte long rng buffer
+
RING_ID rid=rngCreate(0x20);
+
//write bytes into ring buffer
+
putcnt=rngBufPut(rid, blahsrc, strlen(blahsrc)+1);
+
//read bytes back out of ring buffer
+
getcnt=rngBufGet(rid, blahdst, sizeof(blahdst));
+
printf("put %d bytes into buffer, read %d bytes out: %s\n",putcnt,getcnt,blahdst);
+
</source>
+
ring buffers are very useful. ^^
+
 
+
[[Category:NDS]]
+
[[Category:C]]
+
[[Category:LIBTHDS]]
+

Revision as of 20:13, 23 July 2011

rngLib - an implementation of vxWorks style ring buffers

Contents

This info is the cat's pjaamas!

Where to get it

Currently the sources for this are part of LibThds. The source can be downloaded via SVN (see libthds page) or directly from the svn httpd:

32bit buffer versions:

An example of rng32Lib usage that caches keypresses during vblank handler may be found here:

Big help, big help. And superlative news of cruose.

I am forveer indebted to you for this information.

Personal tools
irssi scripts
eggdrop scripts