<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Vidalia: codelength.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_b47abd1aad201a152869566145babb61.html">src</a> » <a class="el" href="dir_ba957854da48b9bba2087c1aa8432048.html">miniupnpc</a> </div> </div> <div class="contents"> <h1>codelength.h</h1><a href="codelength_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* $Id: codelength.h,v 1.1 2008/10/06 22:04:06 nanard Exp $ */</span> <a name="l00002"></a>00002 <span class="comment">/* Project : miniupnp</span> <a name="l00003"></a>00003 <span class="comment"> * Author : Thomas BERNARD</span> <a name="l00004"></a>00004 <span class="comment"> * copyright (c) 2005-2008 Thomas Bernard</span> <a name="l00005"></a>00005 <span class="comment"> * This software is subjet to the conditions detailed in the</span> <a name="l00006"></a>00006 <span class="comment"> * provided LICENCE file. */</span> <a name="l00007"></a>00007 <span class="preprocessor">#ifndef __CODELENGTH_H__</span> <a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define __CODELENGTH_H__</span> <a name="l00009"></a>00009 <span class="preprocessor"></span> <a name="l00010"></a>00010 <span class="comment">/* Encode length by using 7bit per Byte :</span> <a name="l00011"></a>00011 <span class="comment"> * Most significant bit of each byte specifies that the</span> <a name="l00012"></a>00012 <span class="comment"> * following byte is part of the code */</span> <a name="l00013"></a><a class="code" href="codelength_8h.html#a84fc34f746922e2823f36385962fea75">00013</a> <span class="preprocessor">#define DECODELENGTH(n, p) n = 0; \</span> <a name="l00014"></a>00014 <span class="preprocessor"> do { n = (n << 7) | (*p & 0x7f); } \</span> <a name="l00015"></a>00015 <span class="preprocessor"> while(*(p++)&0x80);</span> <a name="l00016"></a>00016 <span class="preprocessor"></span> <a name="l00017"></a><a class="code" href="codelength_8h.html#a112a041ca91d5a760c73ad89d6651a2d">00017</a> <span class="preprocessor">#define CODELENGTH(n, p) if(n>=268435456) *(p++) = (n >> 28) | 0x80; \</span> <a name="l00018"></a>00018 <span class="preprocessor"> if(n>=2097152) *(p++) = (n >> 21) | 0x80; \</span> <a name="l00019"></a>00019 <span class="preprocessor"> if(n>=16384) *(p++) = (n >> 14) | 0x80; \</span> <a name="l00020"></a>00020 <span class="preprocessor"> if(n>=128) *(p++) = (n >> 7) | 0x80; \</span> <a name="l00021"></a>00021 <span class="preprocessor"> *(p++) = n & 0x7f;</span> <a name="l00022"></a>00022 <span class="preprocessor"></span> <a name="l00023"></a>00023 <span class="preprocessor">#endif</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Mon Aug 30 22:58:54 2010 for Vidalia by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>