Skip to content

Commit cd01297

Browse files
authored
Merge pull request #90 from GaragePixel/develop
From stdlib - Min/max additions and array additions
2 parents a92dac9 + 5080047 commit cd01297

2 files changed

Lines changed: 329 additions & 35 deletions

File tree

modules/std/syntax/funcs/minmax.wx

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ Function Min<T1,T2>:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And
3737
End
3838

3939
Function Min<T>:T(a:T,b:T,c:T) Where T Implements INumeric
40-
41-
'3 arguments breaks the overloading of the language min/max stuff
42-
'So the language library non-native stuff was undoned,
43-
'and in the the word we'll have peace!
4440

4541
Return a<b ? (a<c ? a Else c) Else (b<c ? c Else b)
4642
End
@@ -108,3 +104,36 @@ Function Max<T1,T2,T3>:T1(a:T1 Ptr,b:T2 Ptr,c:T3 Ptr) Where T1 Implements INu
108104
'Note that byte with int,float,double are incompatible
109105
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]))
110106
End
107+
108+
Function Min<T>:T(a:T Ptr,b:T Ptr,c:T Ptr,d:T Ptr)
109+
'Pointer version
110+
'Order 4
111+
Return Min(a,Min(b,Min(c,d)))
112+
End
113+
114+
Function Max<T>:T(a:T Ptr,b:T Ptr,c:T Ptr,d:T Ptr)
115+
'Pointer version
116+
'Order 4
117+
Return Max(a,Max(b,Max(c,d)))
118+
End
119+
120+
Function SetMin<T>( a:T Ptr, b:T Ptr)
121+
122+
'iDkP from GaragePixel
123+
'2025-02-18
124+
125+
'Pointer accelerations
126+
If Pointer( b ) < Pointer( a )
127+
Assign( a, b )
128+
End
129+
End
130+
131+
Function SetMax<T>( a:T Ptr, b:T Ptr)
132+
133+
'iDkP from GaragePixel
134+
'2025-02-18
135+
136+
If Pointer( b ) > Pointer( a )
137+
Assign( a, b )
138+
End
139+
End

0 commit comments

Comments
 (0)