Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions modules/std/syntax/funcs/minmax.wx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ Function Min<T1,T2>:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And
End

Function Min<T>:T(a:T,b:T,c:T) Where T Implements INumeric

'3 arguments breaks the overloading of the language min/max stuff
'So the language library non-native stuff was undoned,
'and in the the word we'll have peace!

Return a<b ? (a<c ? a Else c) Else (b<c ? c Else b)
End
Expand Down Expand Up @@ -108,3 +104,36 @@ Function Max<T1,T2,T3>:T1(a:T1 Ptr,b:T2 Ptr,c:T3 Ptr) Where T1 Implements INu
'Note that byte with int,float,double are incompatible
Return Cast<T1>(a[0]<b[0] ? (b[0]<c[0] ? c[0] Else b[0]) Else (a[0]<c[0] ? c[0] Else a[0]))
End

Function Min<T>:T(a:T Ptr,b:T Ptr,c:T Ptr,d:T Ptr)
'Pointer version
'Order 4
Return Min(a,Min(b,Min(c,d)))
End

Function Max<T>:T(a:T Ptr,b:T Ptr,c:T Ptr,d:T Ptr)
'Pointer version
'Order 4
Return Max(a,Max(b,Max(c,d)))
End

Function SetMin<T>( a:T Ptr, b:T Ptr)

'iDkP from GaragePixel
'2025-02-18

'Pointer accelerations
If Pointer( b ) < Pointer( a )
Assign( a, b )
End
End

Function SetMax<T>( a:T Ptr, b:T Ptr)

'iDkP from GaragePixel
'2025-02-18

If Pointer( b ) > Pointer( a )
Assign( a, b )
End
End
Loading
Loading