From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/algo_8h-source.html | 191 +++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 docs/doxygen/nel/algo_8h-source.html (limited to 'docs/doxygen/nel/algo_8h-source.html') diff --git a/docs/doxygen/nel/algo_8h-source.html b/docs/doxygen/nel/algo_8h-source.html new file mode 100644 index 00000000..e6d6d46c --- /dev/null +++ b/docs/doxygen/nel/algo_8h-source.html @@ -0,0 +1,191 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

algo.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000-2002 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_ALGO_H
+00027 #define NL_ALGO_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include <vector>
+00031 #include <string>
+00032 
+00033 
+00034 namespace NLMISC 
+00035 {
+00036 
+00037 // ***************************************************************************
+00053 template <class T, class U>
+00054 T computeBilinear(const T &v0, const T &v1, const T &v2, const T &v3, const U &s, const U &t)
+00055 {
+00056         T h0 = t * v3 + ((U) 1 - t) * v0;
+00057         T h1 = t * v2 + ((U) 1 - t) * v1;
+00058         return s * h1 + ((U) 1 - s) * h0;
+00059 }
+00060 
+00061 // ***************************************************************************
+00068 template<class T>
+00069 uint            searchLowerBound(const T *array, uint arraySize, const T &key)
+00070 {
+00071         uint    start=0;
+00072         uint    end= arraySize;
+00073         // find lower_bound by dichotomy
+00074         while(end-1>start)
+00075         {
+00076                 uint    pivot= (end+start)/2;
+00077                 // return the lower_bound, ie return first start with array[pivot]<=key
+00078                 if(array[pivot] <= key)
+00079                         start= pivot;
+00080                 else
+00081                         end= pivot;
+00082         }
+00083 
+00084         return start;
+00085 }
+00086 
+00087 
+00088 // ***************************************************************************
+00095 template<class T>
+00096 uint            searchLowerBound(const std::vector<T> &array, const T &key)
+00097 {
+00098         uint    size= array.size();
+00099         if(size==0)
+00100                 return 0;
+00101         else
+00102                 return searchLowerBound(&array[0], size, key);
+00103 }
+00104 
+00105 
+00106 // ***************************************************************************
+00109 static inline   void fastClamp8(sint &v)
+00110 {
+00111 #ifdef NL_OS_WINDOWS
+00112         // clamp v in 0..255 (no cond jmp)
+00113         __asm
+00114         {
+00115                 mov             esi, v
+00116                 mov             eax, [esi]
+00117                 mov             ebx, eax
+00118                 // clamp to 0.
+00119                 add             eax, 0x80000000
+00120                 sbb             ecx, ecx
+00121                 not             ecx
+00122                 and             ebx, ecx
+00123                 // clamp to 255.
+00124                 add             eax, 0x7FFFFF00
+00125                 sbb             ecx, ecx
+00126                 and             ebx, 255
+00127                 and             ecx, 255
+00128                 or              ebx, ecx
+00129                 // store
+00130                 mov             [esi], ebx
+00131         }
+00132 #else
+00133         clamp(v, 0, 255);
+00134 #endif
+00135 }
+00136 
+00137 
+00138 // ***************************************************************************
+00149 bool            testWildCard(const char *strIn, const char *wildCard);
+00150 
+00151 
+00152 // ***************************************************************************
+00156 void            splitString(const std::string &str, const std::string &separator, std::vector<std::string> &retList);
+00157 
+00158 
+00159 } // NLMISC
+00160 
+00161 
+00162 #endif // NL_ALGO_H
+00163 
+00164 /* End of algo.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1