_qsort
function · crt · primitive
- Address
0x73f727· 340 bytes, up to0x73f87a- Signature
void __cdecl (void *base, uint32_t num, uint32_t width, int (*compare)(const void *, const void *))- Meaning
- Sorts an array in place by quicksort on a middle pivot, with a selection sort for ranges of 8 elements or fewer
- Confidence
- verified, proof one
- Finding
- ui/auctionlists#the-c-runtime-qsort
- Test
ui::crt_qsort_difftest
Finding: The C runtime qsort in ui: auction lists, sorting and deposits
qsort(base, num, width, comp) (0x73f727, __cdecl) reads only the sign of comp's int. It returns at once for
num below 2 or a width of 0. A range from lo to hi of 8 elements or fewer goes to the short sort. A larger one swaps
the element size / 2 places above lo with lo, the pivot. loguy steps up from lo while loguy <= hi and comp(loguy, lo) <= 0;
higuy steps down from hi + width while higuy > lo and comp(higuy, lo) >= 0. While higuy >= loguy they swap and the
scans resume; then lo swaps with higuy. The pivot is every partition call's second argument. Equal elements are not kept in order.
The derivation is in the doc.
Callers 43
- 0x44b6c0 gx
- SortRealmCategories glue
- BuildNameStatistics glue
- Script::GetRefreshRates ui
- CGGameUI::TargetNearest ui
- BuildMapLists ui
- RebuildBattlefieldScores ui
- RefreshStationery ui
- AddSpellToBook ui
- SortSpellBook ui
- SortAuctionBrowseList ui
- SortAuctionOwnerList ui
- SortAuctionBidderList ui
- OnGuildRoster ui
- SetGuildShowOffline ui
- PromoteGuildSortKey ui
- SortSkillList ui
- SortReputationList ui
- BuildTrainerList ui
- FinalizeTrainerList ui
- RebuildQuestLog ui
- SortQuestLog ui
- RecountLfgTypes ui
- RebuildLfgQuestList ui
- BuildMacroIconList ui
- RebuildMacroOrder ui
- SortCraftList ui
- RebuildBuybackList ui
- SortTradeSkillList ui
- ReadAddOnInfoReply ui
- CGTooltip::BuildItem ui
- CGxDeviceOpenGl::EnumerateModes gx
- Script::SortWho net
- OnWhoList net
- FriendList::SortFriends net
- FriendList::SortIgnores net
- 0x65cd10 unassigned
- 0x65ce90 unassigned
- 0x66c210 storm
- LcdFillBattlefieldScreen ui
- BatchSortQuads ui
- 0x7d35f0 unassigned
- 0x7dc850 unassigned
Callees 2
- _shortsort crt
- _swap crt
Calls and jumps by a bare address, from tables/calls.tsv.