dreamcast/tools/insertion_sort.hpp
Zack Buhman 3b7e1eaef8 example: implement font_outline
This still needs to be cleaned up, particularly to properly pass the
texture size around--there are a few unnecessary '128x256' magic
numbers scattered in the code.
2023-12-22 00:03:52 +08:00

18 lines
289 B
C++

#include <cstdint>
#include <algorithm>
#include <iostream>
template <typename T>
void insertion_sort(T * arr, int len)
{
int i = 1;
while (i < len) {
int j = i;
while (j > 0 && arr[j - 1] < arr[j]) {
std::swap(arr[j - 1], arr[j]);
j -= 1;
}
i += 1;
}
}