diff --git a/docs/html/FixMath_8h.html b/docs/html/FixMath_8h.html index 10c6f8a..038d91e 100644 --- a/docs/html/FixMath_8h.html +++ b/docs/html/FixMath_8h.html @@ -141,9 +141,9 @@ template<typename T > UFix< 0, sizeof(T) *8 > toUFraction (T val)   -template<typename T > -UFix< sizeof(T) *8-1, 0 > toUInt (T val) -  +template<typename T > +UFix< sizeof(T) *8, 0 > toUInt (T val) +  template<int8_t NI, int8_t NF, uint64_t RANGE, int8_t _NI, int8_t _NF, uint64_t _RANGE> SFix< FixMathPrivate::neededSNIExtra(FixMathPrivate::FM_max(NI, _NI), FixMathPrivate::FM_max(NF, _NF), FixMathPrivate::rangeAdd(NF, _NF, RANGE, _RANGE)), FixMathPrivate::FM_max(NF, _NF), FixMathPrivate::rangeAdd(NF, _NF, RANGE, _RANGE)> operator+ (const SFix< NI, NF, RANGE > &op1, const UFix< _NI, _NF, _RANGE > &op2)   @@ -890,8 +890,8 @@

-

◆ toUInt()

+ +

◆ toUInt()

@@ -902,7 +902,7 @@

- + diff --git a/docs/html/FixMath_8h_source.html b/docs/html/FixMath_8h_source.html index fe37070..8d9ae5e 100644 --- a/docs/html/FixMath_8h_source.html +++ b/docs/html/FixMath_8h_source.html @@ -465,8 +465,8 @@
639 }
640 
651 template<typename T>
-
652 inline UFix<sizeof(T)*8-1,0> toUInt(T val) {
-
653  return UFix<sizeof(T)*8-1,0>::fromRaw(val);
+
652 inline UFix<sizeof(T)*8,0> toUInt(T val) {
+
653  return UFix<sizeof(T)*8,0>::fromRaw(val);
654 }
655 
656 
diff --git a/docs/html/globals.html b/docs/html/globals.html index 6b71ee6..a628f77 100644 --- a/docs/html/globals.html +++ b/docs/html/globals.html @@ -93,7 +93,7 @@ : FixMath.h
  • toUInt() -: FixMath.h +: FixMath.h
  • diff --git a/docs/html/globals_func.html b/docs/html/globals_func.html index 4212ab0..5978350 100644 --- a/docs/html/globals_func.html +++ b/docs/html/globals_func.html @@ -93,7 +93,7 @@ : FixMath.h
  • toUInt() -: FixMath.h +: FixMath.h
  • diff --git a/docs/html/search/all_6.js b/docs/html/search/all_6.js index a64d1c8..fe24c43 100644 --- a/docs/html/search/all_6.js +++ b/docs/html/search/all_6.js @@ -3,5 +3,5 @@ var searchData= ['tosfraction_30',['toSFraction',['../FixMath_8h.html#a46b90b067252e2ceeed03c96ccc55fd4',1,'FixMath.h']]], ['tosint_31',['toSInt',['../FixMath_8h.html#a83bd22fe181cddcf4c3faacbe86140fa',1,'FixMath.h']]], ['toufraction_32',['toUFraction',['../FixMath_8h.html#aaaaa1dc404829e0ec37bc565d58f394f',1,'FixMath.h']]], - ['touint_33',['toUInt',['../FixMath_8h.html#a5160f5ab224e5424f6dd9e608db0dc9d',1,'FixMath.h']]] + ['touint_33',['toUInt',['../FixMath_8h.html#aa2666bae0f50341fb0db86af1af47ec9',1,'FixMath.h']]] ]; diff --git a/docs/html/search/functions_6.js b/docs/html/search/functions_6.js index e0f2ea5..e1d03e0 100644 --- a/docs/html/search/functions_6.js +++ b/docs/html/search/functions_6.js @@ -3,5 +3,5 @@ var searchData= ['tosfraction_67',['toSFraction',['../FixMath_8h.html#a46b90b067252e2ceeed03c96ccc55fd4',1,'FixMath.h']]], ['tosint_68',['toSInt',['../FixMath_8h.html#a83bd22fe181cddcf4c3faacbe86140fa',1,'FixMath.h']]], ['toufraction_69',['toUFraction',['../FixMath_8h.html#aaaaa1dc404829e0ec37bc565d58f394f',1,'FixMath.h']]], - ['touint_70',['toUInt',['../FixMath_8h.html#a5160f5ab224e5424f6dd9e608db0dc9d',1,'FixMath.h']]] + ['touint_70',['toUInt',['../FixMath_8h.html#aa2666bae0f50341fb0db86af1af47ec9',1,'FixMath.h']]] ]; diff --git a/docs/latex/FixMath_8h.tex b/docs/latex/FixMath_8h.tex index c486def..6dd3126 100644 --- a/docs/latex/FixMath_8h.tex +++ b/docs/latex/FixMath_8h.tex @@ -2,8 +2,7 @@ \label{FixMath_8h}\index{FixMath.h@{FixMath.h}} {\ttfamily \#include $<$Arduino.\+h$>$}\newline {\ttfamily \#include \char`\"{}Integer\+Type.\+h\char`\"{}}\newline -Include dependency graph for Fix\+Math.\+h\+: -\nopagebreak +Include dependency graph for Fix\+Math.\+h\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode @@ -60,7 +59,7 @@ \item {\footnotesize template$<$typename T $>$ }\\\mbox{\hyperlink{classUFix}{UFix}}$<$ 0, sizeof(T) $\ast$8 $>$ \mbox{\hyperlink{FixMath_8h_aaaaa1dc404829e0ec37bc565d58f394f}{to\+UFraction}} (T val) \item -{\footnotesize template$<$typename T $>$ }\\\mbox{\hyperlink{classUFix}{UFix}}$<$ sizeof(T) $\ast$8-\/1, 0 $>$ \mbox{\hyperlink{FixMath_8h_a5160f5ab224e5424f6dd9e608db0dc9d}{to\+UInt}} (T val) +{\footnotesize template$<$typename T $>$ }\\\mbox{\hyperlink{classUFix}{UFix}}$<$ sizeof(T) $\ast$8, 0 $>$ \mbox{\hyperlink{FixMath_8h_aa2666bae0f50341fb0db86af1af47ec9}{to\+UInt}} (T val) \item {\footnotesize template$<$int8\+\_\+t NI, int8\+\_\+t NF, uint64\+\_\+t RANGE, int8\+\_\+t \+\_\+\+NI, int8\+\_\+t \+\_\+\+NF, uint64\+\_\+t \+\_\+\+RANGE$>$ }\\\mbox{\hyperlink{classSFix}{SFix}}$<$ Fix\+Math\+Private\+::needed\+SNIExtra(Fix\+Math\+Private\+::\+FM\+\_\+max(NI, \+\_\+\+NI), Fix\+Math\+Private\+::\+FM\+\_\+max(NF, \+\_\+\+NF), Fix\+Math\+Private\+::range\+Add(NF, \+\_\+\+NF, RANGE, \+\_\+\+RANGE)), Fix\+Math\+Private\+::\+FM\+\_\+max(NF, \+\_\+\+NF), Fix\+Math\+Private\+::range\+Add(NF, \+\_\+\+NF, RANGE, \+\_\+\+RANGE)$>$ \mbox{\hyperlink{FixMath_8h_a83bdc57433394da979b73216f504a531}{operator+}} (const \mbox{\hyperlink{classSFix}{SFix}}$<$ NI, NF, RANGE $>$ \&op1, const \mbox{\hyperlink{classUFix}{UFix}}$<$ \+\_\+\+NI, \+\_\+\+NF, \+\_\+\+RANGE $>$ \&op2) \item @@ -428,12 +427,12 @@ \begin{DoxyReturn}{Returns} A UFix$<$0,\+NF$>$ with NF chosen according to the input type \end{DoxyReturn} -\mbox{\Hypertarget{FixMath_8h_a5160f5ab224e5424f6dd9e608db0dc9d}\label{FixMath_8h_a5160f5ab224e5424f6dd9e608db0dc9d}} +\mbox{\Hypertarget{FixMath_8h_aa2666bae0f50341fb0db86af1af47ec9}\label{FixMath_8h_aa2666bae0f50341fb0db86af1af47ec9}} \index{FixMath.h@{FixMath.h}!toUInt@{toUInt}} \index{toUInt@{toUInt}!FixMath.h@{FixMath.h}} \doxysubsubsection{\texorpdfstring{toUInt()}{toUInt()}} {\footnotesize\ttfamily template$<$typename T $>$ \\ -\mbox{\hyperlink{classUFix}{UFix}}$<$sizeof(T)$\ast$8-\/1,0$>$ to\+UInt (\begin{DoxyParamCaption}\item[{T}]{val }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}} +\mbox{\hyperlink{classUFix}{UFix}}$<$sizeof(T)$\ast$8,0$>$ to\+UInt (\begin{DoxyParamCaption}\item[{T}]{val }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}} Create a {\itshape pure} integer unsigned fixed number (\mbox{\hyperlink{classUFix}{UFix}}) from an unsigned integer. The number of fractional bits (NI) is chosen automatically depending on the input type. Hence to\+UInt(255) and to\+UInt(uint8\+\_\+t(255)) {\itshape do not} lead to the same thing\+: on an AVR, the former will lead to NI=16 -\/ which is overkill -\/ whereas the latter will lead to NI=8. Mozzi\textquotesingle{}s objects (Oscil and the like) returns correct types, hence you can use this function to convert the return value of a Mozzi\textquotesingle{}s function/class member into a pure fractional number. \begin{DoxyParams}{Parameters}
    UFix<sizeof(T)*8-1,0> toUInt UFix<sizeof(T)*8,0> toUInt ( val)