switch to shell scripts
[convexer.git] / nbvtf / rgbcx.h
index dd199b781471d6ce432b798b9549048d0e332454..620441b3fc7c98b678a5c355e0223aad8091ef5e 100644 (file)
 
 #include <stdlib.h>
 #include <stdint.h>
-#include <algorithm>
 #include <assert.h>
+
+#ifndef RGBCX_NO_ALGORITHM
+ #include <algorithm>
+#else
+int std_sort_int (const void * a, const void * b)
+{
+  return ( *(int*)a - *(int*)b );
+}
+#endif
+
 #include <limits.h>
 
 // By default, the table used to accelerate cluster fit on 4 color blocks uses a 969x128 entry table. 
@@ -2818,7 +2827,11 @@ namespace rgbcx
                                dots[i] = (d << 4) + i;
                        }
 
-                       std::sort(dots, dots + 16);
+#ifdef RGBCX_NO_ALGORITHM
+         qsort( dots, 16, sizeof(int), std_sort_int );
+#else
+         std::sort(dots, dots + 16); 
+#endif
 
                        uint32_t r_sum[17], g_sum[17], b_sum[17];
                        uint32_t r = 0, g = 0, b = 0;
@@ -3716,9 +3729,13 @@ namespace rgbcx
                                        assert(d >= 0);
                                        dots[i] = (d << 4) + i;
                                }
+                               
+#ifdef RGBCX_NO_ALGORITHM
+            qsort( dots, 16, sizeof(int), std_sort_int );
+#else
+            std::sort(dots, dots + 16); 
+#endif
 
-                               std::sort(dots, dots + 16);
-                                                               
                                uint32_t r_sum[17], g_sum[17], b_sum[17];
                                uint32_t r = 0, g = 0, b = 0;
                                for (uint32_t i = 0; i < 16; i++)