MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Hotkeys_QuickSort

Function Hotkeys_QuickSort

src/InputHandler.c:94–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92struct StringsBuffer CC_BIG_VAR HotkeysText;
93
94static void Hotkeys_QuickSort(int left, int right) {
95 struct HotkeyData* keys = HotkeysList; struct HotkeyData key;
96
97 while (left < right) {
98 int i = left, j = right;
99 cc_uint8 pivot = keys[(i + j) >> 1].mods;
100
101 /* partition the list */
102 while (i <= j) {
103 while (pivot < keys[i].mods) i++;
104 while (pivot > keys[j].mods) j--;
105 QuickSort_Swap_Maybe();
106 }
107 /* recurse into the smaller subset */
108 QuickSort_Recurse(Hotkeys_QuickSort)
109 }
110}
111
112static void Hotkeys_AddNewHotkey(int trigger, cc_uint8 modifiers, const cc_string* text, cc_uint8 flags) {
113 struct HotkeyData hKey;

Callers 1

Hotkeys_AddNewHotkeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected