Rename def to alias.

This commit is contained in:
Christoffer Lerno
2025-03-13 11:22:27 +01:00
parent ae76839347
commit 8b49e6c14d
193 changed files with 790 additions and 776 deletions

View File

@@ -26,21 +26,21 @@ macro quicksort_indexed(list, start, end, cmp = EMPTY_MACRO_SLOT, context = EMPT
module std::sort::cs{Type, KeyFn};
def Counts = usz[256] @private;
def Ranges = usz[257] @private;
def Indexs = char[256] @private;
def ElementType = $typeof((Type){}[0]);
alias Counts = usz[256] @private;
alias Ranges = usz[257] @private;
alias Indexs = char[256] @private;
alias ElementType = $typeof((Type){}[0]);
const bool NO_KEY_FN @private = types::is_same(KeyFn, EmptySlot);
const bool KEY_BY_VALUE @private = NO_KEY_FN ||| $assignable((Type){}[0], $typefrom(KeyFn.paramsof[0].type));
const bool LIST_HAS_REF @private = $defined(&(Type){}[0]);
def KeyFnReturnType = $typefrom(KeyFn.returns) @if(!NO_KEY_FN);
def KeyFnReturnType = ElementType @if(NO_KEY_FN);
def CmpCallback = fn int(ElementType, ElementType) @if(KEY_BY_VALUE && NO_KEY_FN);
def CmpCallback = fn int(ElementType*, ElementType*) @if(!KEY_BY_VALUE && NO_KEY_FN);
def CmpCallback = fn int(ElementType, ElementType, KeyFn) @if(KEY_BY_VALUE && !NO_KEY_FN);
def CmpCallback = fn int(ElementType*, ElementType*, KeyFn) @if(!KEY_BY_VALUE && !NO_KEY_FN);
alias KeyFnReturnType = $typefrom(KeyFn.returns) @if(!NO_KEY_FN);
alias KeyFnReturnType = ElementType @if(NO_KEY_FN);
alias CmpCallback = fn int(ElementType, ElementType) @if(KEY_BY_VALUE && NO_KEY_FN);
alias CmpCallback = fn int(ElementType*, ElementType*) @if(!KEY_BY_VALUE && NO_KEY_FN);
alias CmpCallback = fn int(ElementType, ElementType, KeyFn) @if(KEY_BY_VALUE && !NO_KEY_FN);
alias CmpCallback = fn int(ElementType*, ElementType*, KeyFn) @if(!KEY_BY_VALUE && !NO_KEY_FN);
fn void csort(Type list, usz low, usz high, KeyFn key_fn, uint byte_idx)
{

View File

@@ -19,7 +19,7 @@ macro insertionsort(list, cmp = EMPTY_MACRO_SLOT, context = EMPTY_MACRO_SLOT) @b
module std::sort::is{Type, CmpFn, Context};
def ElementType = $typeof(((Type){})[0]);
alias ElementType = $typeof(((Type){})[0]);
fn void isort(Type list, usz low, usz high, CmpFn comp, Context context)
{

View File

@@ -35,7 +35,7 @@ macro quickselect(list, isz k, cmp = EMPTY_MACRO_SLOT, context = EMPTY_MACRO_SLO
module std::sort::qs{Type, CmpFn, Context};
def ElementType = $typeof(((Type){})[0]);
alias ElementType = $typeof(((Type){})[0]);
struct StackElementItem @private
{
@@ -43,7 +43,7 @@ struct StackElementItem @private
isz high;
}
def Stack = StackElementItem[64] @private;
alias Stack = StackElementItem[64] @private;
// Based on https://alienryderflex.com/quicksort by Darel Rex Finley, Public Domain.