]> git.sesse.net Git - stockfish/blobdiff - src/types.h
Rename and de-templetize sort()
[stockfish] / src / types.h
index 506e1b0f9b5f1adeb6c82db127d89b5165432ec4..aa1f34fc112eaadf00663778a94a5e3ba11f2440 100644 (file)
@@ -441,8 +441,8 @@ inline int square_distance(Square s1, Square s2) {
   return SquareDistance[s1][s2];
 }
 
-inline char file_to_char(File f) {
-  return char(f - FILE_A + 'a');
+inline char file_to_char(File f, bool tolower = true) {
+  return char(f - FILE_A + (tolower ? 'a' : 'A'));
 }
 
 inline char rank_to_char(Rank r) {
@@ -489,21 +489,4 @@ inline const std::string square_to_string(Square s) {
   return ch;
 }
 
-/// Our insertion sort implementation, works with pointers and iterators and is
-/// guaranteed to be stable, as is needed.
-template<typename T, typename K>
-void sort(K begin, K end)
-{
-  T tmp;
-  K p, q;
-
-  for (p = begin + 1; p < end; p++)
-  {
-      tmp = *p;
-      for (q = p; q != begin && *(q-1) < tmp; --q)
-          *q = *(q-1);
-      *q = tmp;
-  }
-}
-
 #endif // !defined(TYPES_H_INCLUDED)