<!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/html;charset=UTF-8"/> <title>libkate: /home/v/Kate/WORK_TREES/kate-sorceress-backup/v/src/kate/src/kate_fp.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.0 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</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>Globals</span></a></li> </ul> </div> <h1>/home/v/Kate/WORK_TREES/kate-sorceress-backup/v/src/kate/src/kate_fp.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Copyright (C) 2008 Vincent Penquerc'h.</span> <a name="l00002"></a>00002 <span class="comment"> This file is part of the Kate codec library.</span> <a name="l00003"></a>00003 <span class="comment"> Written by Vincent Penquerc'h.</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment"> Use, distribution and reproduction of this library is governed</span> <a name="l00006"></a>00006 <span class="comment"> by a BSD style source license included with this source in the</span> <a name="l00007"></a>00007 <span class="comment"> file 'COPYING'. Please read these terms before distributing. */</span> <a name="l00008"></a>00008 <a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="preprocessor">#ifndef KATE_kate_fp_h_GUARD</span> <a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define KATE_kate_fp_h_GUARD</span> <a name="l00012"></a>00012 <span class="preprocessor"></span> <a name="l00013"></a>00013 <span class="preprocessor">#include "kate_internal.h"</span> <a name="l00014"></a>00014 <span class="preprocessor">#include "<a class="code" href="kate_8h.html">kate/kate.h</a>"</span> <a name="l00015"></a>00015 <span class="preprocessor">#include "kate_bitwise.h"</span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="keyword">typedef</span> int32_t kate_fp; <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="comment">/* equal bits for int/frac */</span> <a name="l00020"></a>00020 <span class="comment">/* #define KATE_FP_FRAC (sizeof(kate_fp)*8/2) */</span> <a name="l00021"></a>00021 <span class="comment">/* more bits here for added frac precision (but less int range (and probably more space taken in the bitstream)) */</span> <a name="l00022"></a>00022 <span class="preprocessor">#define KATE_FP_FRAC (sizeof(kate_fp)*4)</span> <a name="l00023"></a>00023 <span class="preprocessor"></span> <a name="l00024"></a>00024 <span class="preprocessor">#if 0</span> <a name="l00025"></a>00025 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keyword">inline</span> kate_fp kate_fp_mul(kate_fp x,kate_fp y) <a name="l00026"></a>00026 { <a name="l00027"></a>00027 int64_t v=x; <a name="l00028"></a>00028 v*=y; <a name="l00029"></a>00029 v>>=KATE_FP_FRAC; <a name="l00030"></a>00030 <span class="keywordflow">return</span> v; <a name="l00031"></a>00031 } <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">static</span> <span class="keyword">inline</span> kate_fp kate_fp_div(kate_fp x,kate_fp y) <a name="l00034"></a>00034 { <a name="l00035"></a>00035 int64_t v=x; <a name="l00036"></a>00036 v<<=KATE_FP_FRAC; <a name="l00037"></a>00037 v/=y; <a name="l00038"></a>00038 <span class="keywordflow">return</span> v; <a name="l00039"></a>00039 } <a name="l00040"></a>00040 <a name="l00041"></a>00041 <span class="keyword">static</span> <span class="keyword">inline</span> kate_fp kate_fp_add(kate_fp x, kate_fp y) <a name="l00042"></a>00042 { <a name="l00043"></a>00043 <span class="keywordflow">return</span> x+y; <a name="l00044"></a>00044 } <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="keyword">static</span> <span class="keyword">inline</span> kate_fp kate_fp_sub(kate_fp x, kate_fp y) <a name="l00047"></a>00047 { <a name="l00048"></a>00048 <span class="keywordflow">return</span> x-y; <a name="l00049"></a>00049 } <a name="l00050"></a>00050 <span class="preprocessor">#endif</span> <a name="l00051"></a>00051 <span class="preprocessor"></span> <a name="l00052"></a>00052 <span class="keyword">extern</span> <span class="keywordtype">int</span> kate_fp_encode(<span class="keywordtype">size_t</span> count,<span class="keyword">const</span> kate_fp *values,<span class="keywordtype">size_t</span> streams,<a class="code" href="structkate__pack__buffer.html">kate_pack_buffer</a> *kpb) kate_internal; <a name="l00053"></a>00053 <span class="keyword">extern</span> <span class="keywordtype">int</span> kate_fp_encode_kate_float(<span class="keywordtype">size_t</span> count,<span class="keyword">const</span> kate_float *values,<span class="keywordtype">size_t</span> streams,<a class="code" href="structkate__pack__buffer.html">kate_pack_buffer</a> *kpb) kate_internal; <a name="l00054"></a>00054 <span class="keyword">extern</span> <span class="keywordtype">int</span> kate_fp_decode(<span class="keywordtype">size_t</span> count,kate_fp *values,<span class="keywordtype">size_t</span> streams,<a class="code" href="structkate__pack__buffer.html">kate_pack_buffer</a> *kpb) kate_internal; <a name="l00055"></a>00055 <span class="keyword">extern</span> <span class="keywordtype">int</span> kate_fp_decode_kate_float(<span class="keywordtype">size_t</span> count,kate_float *values,<span class="keywordtype">size_t</span> streams,<a class="code" href="structkate__pack__buffer.html">kate_pack_buffer</a> *kpb) kate_internal; <a name="l00056"></a>00056 <a name="l00057"></a>00057 <span class="preprocessor">#endif</span> <a name="l00058"></a>00058 <span class="preprocessor"></span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated on Sun Aug 21 13:11:14 2011 for libkate by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.0 </small></address> </body> </html>