\hypertarget{group__Eina__Convert__Group}{}\section{Convert}
\label{group__Eina__Convert__Group}\index{Convert@{Convert}}


These functions allow you to convert integer or real numbers to string or conversely.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}{eina\+\_\+convert\+\_\+itoa}} (int n, char $\ast$s) \mbox{\hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+LL}}(2)
\begin{DoxyCompactList}\small\item\em Converts an integer number to a string in decimal base. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}{eina\+\_\+convert\+\_\+xtoa}} (unsigned int n, char $\ast$s) \mbox{\hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+LL}}(2)
\begin{DoxyCompactList}\small\item\em Converts an integer number to a string in hexadecimal base. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\+\_\+convert\+\_\+dtoa}} (double d, char $\ast$des) \mbox{\hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+LL}}(2)
\begin{DoxyCompactList}\small\item\em Converts a double to a string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod}} (const char $\ast$src, int length, long long $\ast$m, long $\ast$e) \mbox{\hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+LL}}(1
\begin{DoxyCompactList}\small\item\em Converts a string to a double. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int \mbox{\hyperlink{group__Eina__Convert__Group_gaec03d1cb47203e9b66090b4388e40ff3}{eina\+\_\+convert\+\_\+fptoa}} (\mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}} fp, char $\ast$des) \mbox{\hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+LL}}(2)
\begin{DoxyCompactList}\small\item\em Converts a 32.\+32 fixed point number to a string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Eina__Convert__Group_gad78818286f5d7c3a0dc06eb50f2a133e}{eina\+\_\+convert\+\_\+atofp}} (const char $\ast$src, int length, \mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}} $\ast$fp) \mbox{\hyperlink{group__Eina__Types__Group_ga1a066aa3069f7e43279021cc1e378fac}{E\+I\+N\+A\+\_\+\+A\+R\+G\+\_\+\+N\+O\+N\+N\+U\+LL}}(1
\begin{DoxyCompactList}\small\item\em Converts a string to a 32.\+32 fixed point number. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Convert__Group_gabffa0e511b7f490b1b5aef7297970a33}\label{group__Eina__Convert__Group_gabffa0e511b7f490b1b5aef7297970a33}} 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} \mbox{\hyperlink{group__Eina__Convert__Group_gabffa0e511b7f490b1b5aef7297970a33}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+N\+V\+E\+R\+T\+\_\+\+P\+\_\+\+N\+O\+T\+\_\+\+F\+O\+U\+ND}}
\begin{DoxyCompactList}\small\item\em Not used, perhaps a placeholder? Defined as 0 in eina\+\_\+convert.\+c. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group__Eina__Convert__Group_ga8d6d0c014cab017e97c3a383bcf0300c}\label{group__Eina__Convert__Group_ga8d6d0c014cab017e97c3a383bcf0300c}} 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} \mbox{\hyperlink{group__Eina__Convert__Group_ga8d6d0c014cab017e97c3a383bcf0300c}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+N\+V\+E\+R\+T\+\_\+0\+X\+\_\+\+N\+O\+T\+\_\+\+F\+O\+U\+ND}}
\begin{DoxyCompactList}\small\item\em Not used, perhaps a placeholder? Defined as 0 in eina\+\_\+convert.\+c. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group__Eina__Convert__Group_ga9a0ed4d1300fb636797b638124c0cbe6}\label{group__Eina__Convert__Group_ga9a0ed4d1300fb636797b638124c0cbe6}} 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} \mbox{\hyperlink{group__Eina__Convert__Group_ga9a0ed4d1300fb636797b638124c0cbe6}{E\+I\+N\+A\+\_\+\+E\+R\+R\+O\+R\+\_\+\+C\+O\+N\+V\+E\+R\+T\+\_\+\+O\+U\+T\+R\+U\+N\+\_\+\+S\+T\+R\+I\+N\+G\+\_\+\+L\+E\+N\+G\+TH}}
\begin{DoxyCompactList}\small\item\em Not used, perhaps a placeholder? Defined as 0 in eina\+\_\+convert.\+c. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
These functions allow you to convert integer or real numbers to string or conversely. 

To use these functions, you have to call \mbox{\hyperlink{group__Eina__Main__Group_gafee4bfc0e509b6ffed6598edf6f4b3de}{eina\+\_\+init()}} first, and \mbox{\hyperlink{group__Eina__Main__Group_ga2c8b4020427108a30c44707af22c99d3}{eina\+\_\+shutdown()}} when eina is not used anymore.\hypertarget{group__Eina__Convert__Group_Eina_Convert_From_Integer_To_String}{}\subsection{Conversion from integer to string}\label{group__Eina__Convert__Group_Eina_Convert_From_Integer_To_String}
To convert an integer to a string in the decimal base, \mbox{\hyperlink{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}{eina\+\_\+convert\+\_\+itoa()}} should be used. If the hexadecimal base is wanted, \mbox{\hyperlink{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}{eina\+\_\+convert\+\_\+xtoa()}} should be used. They all need a buffer sufficiently large to store all the cyphers.

Here is an example of use\+:


\begin{DoxyCode}
\textcolor{preprocessor}{#include <stdlib.h>}
\textcolor{preprocessor}{#include <stdio.h>}

\textcolor{preprocessor}{#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{char} tmp[128];

   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eina__Main__Group_gafee4bfc0e509b6ffed6598edf6f4b3de}{eina\_init}}())
   \{
       printf (\textcolor{stringliteral}{"Error during the initialization of eina.\(\backslash\)n"});
       \textcolor{keywordflow}{return} EXIT\_FAILURE;
   \}

   \mbox{\hyperlink{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}{eina\_convert\_itoa}}(45, tmp);
   printf(\textcolor{stringliteral}{"value: %s\(\backslash\)n"}, tmp);
   \mbox{\hyperlink{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}{eina\_convert\_xtoa}}(0xA1, tmp);
   printf(\textcolor{stringliteral}{"value: %s\(\backslash\)n"}, tmp);

   \mbox{\hyperlink{group__Eina__Main__Group_ga2c8b4020427108a30c44707af22c99d3}{eina\_shutdown}}();

   \textcolor{keywordflow}{return} EXIT\_SUCCESS;
\}
\end{DoxyCode}


Compile this code with the following command\+:


\begin{DoxyCode}
gcc -Wall -o test\_eina\_convert test\_eina.c `pkg-config --cflags --libs eina`
\end{DoxyCode}


\begin{DoxyNote}{Note}
The alphabetical cyphers are in lower case.
\end{DoxyNote}
\hypertarget{group__Eina__Convert__Group_Eina_Convert_Double}{}\subsection{Conversion double / string}\label{group__Eina__Convert__Group_Eina_Convert_Double}
To convert a double to a string, \mbox{\hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\+\_\+convert\+\_\+dtoa()}} should be used. Like with the integer functions, a buffer must be used. The resulting string has the following format (which is the result obtained with snprintf() and the \%a modifier)\+:


\begin{DoxyCode}
[-]0xh.hhhhhp[+-]e
\end{DoxyCode}


To convert a string to a double, \mbox{\hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod()}} should be used. The format of the string must be as above. Then, the double has the following mantissas and exponent\+:


\begin{DoxyCode}
mantissa  : [-]hhhhhh
exponent : 2^([+-]e - 4 * n)
\end{DoxyCode}


with n being number of cyphers after the point in the string format. To obtain the double number from the mantissas and exponent, use ldexp().

Here is an example of use\+:


\begin{DoxyCode}
\textcolor{preprocessor}{#include <stdlib.h>}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <math.h>}

\textcolor{preprocessor}{#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{char}      tmp[128];
   \textcolor{keywordtype}{long} \textcolor{keywordtype}{long} \textcolor{keywordtype}{int} m = 0;
   \textcolor{keywordtype}{long} \textcolor{keywordtype}{int}  e = 0;
   \textcolor{keywordtype}{double}    r;

   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eina__Main__Group_gafee4bfc0e509b6ffed6598edf6f4b3de}{eina\_init}}())
   \{
       printf (\textcolor{stringliteral}{"Error during the initialization of eina.\(\backslash\)n"});
       \textcolor{keywordflow}{return} EXIT\_FAILURE;
   \}

   printf(\textcolor{stringliteral}{"initial value : 40.56\(\backslash\)n"});
   \mbox{\hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\_convert\_dtoa}}(40.56, tmp);
   printf(\textcolor{stringliteral}{"result dtoa   : %s\(\backslash\)n"}, tmp);

   \mbox{\hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\_convert\_atod}}(tmp, 128, &m, &e);
   r = ldexp((\textcolor{keywordtype}{double})m, e);
   printf(\textcolor{stringliteral}{"result atod   : %f\(\backslash\)n"}, r);

   \mbox{\hyperlink{group__Eina__Main__Group_ga2c8b4020427108a30c44707af22c99d3}{eina\_shutdown}}();

   \textcolor{keywordflow}{return} EXIT\_SUCCESS;
\}
\end{DoxyCode}


Compile this code with the following command\+:


\begin{DoxyCode}
gcc -Wall -o test\_eina\_convert test\_eina.c `pkg-config --cflags --libs eina` -lm
\end{DoxyCode}
 

\subsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}\label{group__Eina__Convert__Group_gafe831a6e2a4017b2fae5c29d60d53586}} 
\index{Convert@{Convert}!eina\+\_\+convert\+\_\+itoa@{eina\+\_\+convert\+\_\+itoa}}
\index{eina\+\_\+convert\+\_\+itoa@{eina\+\_\+convert\+\_\+itoa}!Convert@{Convert}}
\subsubsection{\texorpdfstring{eina\+\_\+convert\+\_\+itoa()}{eina\_convert\_itoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int eina\+\_\+convert\+\_\+itoa (\begin{DoxyParamCaption}\item[{int}]{n,  }\item[{char $\ast$}]{s }\end{DoxyParamCaption})}



Converts an integer number to a string in decimal base. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em n} & The integer to convert. \\
\hline
\mbox{\tt out}  & {\em s} & The buffer to store the converted integer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The length of the string, including the null terminated character.
\end{DoxyReturn}
This function converts {\ttfamily n} to a null terminated string. The converted string is in decimal base. As no check is done, {\ttfamily s} must be a buffer that is sufficiently large to store the integer.

The returned value is the length of the string, including the null terminated character. 

Referenced by eina\+\_\+xattr\+\_\+int\+\_\+set().

\mbox{\Hypertarget{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}\label{group__Eina__Convert__Group_gae539636184d2c4e80c2e29bf26f40be1}} 
\index{Convert@{Convert}!eina\+\_\+convert\+\_\+xtoa@{eina\+\_\+convert\+\_\+xtoa}}
\index{eina\+\_\+convert\+\_\+xtoa@{eina\+\_\+convert\+\_\+xtoa}!Convert@{Convert}}
\subsubsection{\texorpdfstring{eina\+\_\+convert\+\_\+xtoa()}{eina\_convert\_xtoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int eina\+\_\+convert\+\_\+xtoa (\begin{DoxyParamCaption}\item[{unsigned int}]{n,  }\item[{char $\ast$}]{s }\end{DoxyParamCaption})}



Converts an integer number to a string in hexadecimal base. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em n} & The integer to convert. \\
\hline
\mbox{\tt out}  & {\em s} & The buffer to store the converted integer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The length of the string, including the null terminated character.
\end{DoxyReturn}
This function converts {\ttfamily n} to a null terminated string. The converted string is in hexadecimal base and the alphabetical cyphers are in lower case. As no check is done, {\ttfamily s} must be a buffer that is sufficiently large to store the integer.

The returned value is the length of the string, including the nul terminated character. \mbox{\Hypertarget{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}\label{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}} 
\index{Convert@{Convert}!eina\+\_\+convert\+\_\+dtoa@{eina\+\_\+convert\+\_\+dtoa}}
\index{eina\+\_\+convert\+\_\+dtoa@{eina\+\_\+convert\+\_\+dtoa}!Convert@{Convert}}
\subsubsection{\texorpdfstring{eina\+\_\+convert\+\_\+dtoa()}{eina\_convert\_dtoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int eina\+\_\+convert\+\_\+dtoa (\begin{DoxyParamCaption}\item[{double}]{d,  }\item[{char $\ast$}]{des }\end{DoxyParamCaption})}



Converts a double to a string. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em d} & The double to convert. \\
\hline
\mbox{\tt out}  & {\em des} & The destination buffer to store the converted double. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE}} on success, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE}} otherwise.
\end{DoxyReturn}
This function converts the double {\ttfamily d} to a string. The string is stored in the buffer pointed by {\ttfamily des} and must be sufficiently large to contain the converted double. The returned string is null terminated and has the following format\+:


\begin{DoxyCode}
[-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h are the hexadecimal cyphers of the mantissas and e the exponent (a decimal number).

The returned value is the length of the string, including the null character. 

Referenced by eina\+\_\+xattr\+\_\+double\+\_\+set().

\mbox{\Hypertarget{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}\label{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}} 
\index{Convert@{Convert}!eina\+\_\+convert\+\_\+atod@{eina\+\_\+convert\+\_\+atod}}
\index{eina\+\_\+convert\+\_\+atod@{eina\+\_\+convert\+\_\+atod}!Convert@{Convert}}
\subsubsection{\texorpdfstring{eina\+\_\+convert\+\_\+atod()}{eina\_convert\_atod()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+convert\+\_\+atod (\begin{DoxyParamCaption}\item[{const char $\ast$}]{src,  }\item[{int}]{length,  }\item[{long long $\ast$}]{m,  }\item[{long $\ast$}]{e }\end{DoxyParamCaption})}



Converts a string to a double. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em src} & The string to convert. \\
\hline
\mbox{\tt in}  & {\em length} & The length of the string. \\
\hline
\mbox{\tt out}  & {\em m} & The mantissa. \\
\hline
\mbox{\tt out}  & {\em e} & The exponent. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE}} on success, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE}} otherwise.
\end{DoxyReturn}
This function converts the string {\ttfamily s} of length {\ttfamily length} that represent a double in hexadecimal base to a double. It is used to replace the use of snprintf() with the \%a modifier, which is missing on some platform (like Windows (tm) or Open\+B\+SD).

The string must have the following format\+:


\begin{DoxyCode}
[-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h are the hexadecimal cyphers of the mantissas and e the exponent (a decimal number). If n is the number of cyphers after the point, the returned mantissas and exponents are\+:


\begin{DoxyCode}
mantissa  : [-]hhhhhh
exponent : 2^([+-]e - 4 * n)
\end{DoxyCode}


The mantissas and exponent are stored in the buffers pointed respectively by {\ttfamily m} and {\ttfamily e}.

If the string is invalid \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE}} is returned, otherwise \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE}} is returned. \mbox{\Hypertarget{group__Eina__Convert__Group_gaec03d1cb47203e9b66090b4388e40ff3}\label{group__Eina__Convert__Group_gaec03d1cb47203e9b66090b4388e40ff3}} 
\index{Convert@{Convert}!eina\+\_\+convert\+\_\+fptoa@{eina\+\_\+convert\+\_\+fptoa}}
\index{eina\+\_\+convert\+\_\+fptoa@{eina\+\_\+convert\+\_\+fptoa}!Convert@{Convert}}
\subsubsection{\texorpdfstring{eina\+\_\+convert\+\_\+fptoa()}{eina\_convert\_fptoa()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} int eina\+\_\+convert\+\_\+fptoa (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}}}]{fp,  }\item[{char $\ast$}]{des }\end{DoxyParamCaption})}



Converts a 32.\+32 fixed point number to a string. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em fp} & The fixed point number to convert. \\
\hline
\mbox{\tt out}  & {\em des} & The destination buffer to store the converted fixed point number. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE}} on success, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE}} otherwise.
\end{DoxyReturn}
This function converts the 32.\+32 fixed point number {\ttfamily fp} to a string. The string is stored in the buffer pointed by {\ttfamily des} and must be sufficiently large to contain the converted fixed point number. The returned string is terminated and has the following format\+:


\begin{DoxyCode}
[-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h are the hexadecimal cyphers of the mantissas and e the exponent (a decimal number).

The returned value is the length of the string, including the null character.

\begin{DoxyNote}{Note}
The code is the same than \mbox{\hyperlink{group__Eina__Convert__Group_ga033cc5d08cc40bd61943b38273dc5c33}{eina\+\_\+convert\+\_\+dtoa()}} except that it implements the frexp() function for fixed point numbers and does some optimization. 
\end{DoxyNote}
\mbox{\Hypertarget{group__Eina__Convert__Group_gad78818286f5d7c3a0dc06eb50f2a133e}\label{group__Eina__Convert__Group_gad78818286f5d7c3a0dc06eb50f2a133e}} 
\index{Convert@{Convert}!eina\+\_\+convert\+\_\+atofp@{eina\+\_\+convert\+\_\+atofp}}
\index{eina\+\_\+convert\+\_\+atofp@{eina\+\_\+convert\+\_\+atofp}!Convert@{Convert}}
\subsubsection{\texorpdfstring{eina\+\_\+convert\+\_\+atofp()}{eina\_convert\_atofp()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}} eina\+\_\+convert\+\_\+atofp (\begin{DoxyParamCaption}\item[{const char $\ast$}]{src,  }\item[{int}]{length,  }\item[{\mbox{\hyperlink{group__Eina__Fp__Group_ga5264584bb5c6d81dd71d36f9e4e517f1}{Eina\+\_\+\+F32p32}} $\ast$}]{fp }\end{DoxyParamCaption})}



Converts a string to a 32.\+32 fixed point number. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em src} & The string to convert. \\
\hline
\mbox{\tt in}  & {\em length} & The length of the string. \\
\hline
\mbox{\tt out}  & {\em fp} & The fixed point number. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE}} on success, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE}} otherwise.
\end{DoxyReturn}
This function converts the string {\ttfamily src} of length {\ttfamily length} that represent a double in hexadecimal base to a 32.\+32 fixed point number stored in {\ttfamily fp}. The function always tries to convert the string with \mbox{\hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod()}}.

The string must have the following format\+:


\begin{DoxyCode}
[-]0xh.hhhhhp[+-]e
\end{DoxyCode}


where the h\textquotesingle{}s are the hexadecimal cyphers of the mantissas and e the exponent (a decimal number). If n is the number of cyphers after the point, the returned mantissas and exponents are\+:


\begin{DoxyCode}
mantissa  : [-]hhhhhh
exponent : 2^([+-]e - 4 * n)
\end{DoxyCode}


The mantissas and exponent are stored in the buffers pointed respectively by {\ttfamily m} and {\ttfamily e}.

If the string is invalid, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE}} is returned, otherwise {\ttfamily fp} is computed and \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE}} is returned.

\begin{DoxyNote}{Note}
The code uses \mbox{\hyperlink{group__Eina__Convert__Group_gae19e891bfefff785bc42c9ec72bdb224}{eina\+\_\+convert\+\_\+atod()}} and do the correct bit shift to compute the fixed point number. 
\end{DoxyNote}
