--- /dev/null
+// math.asm: WORD p_max, 'MAX',fasm
+
+anchor:p_max[]
+
+=== Word: MAX
+
+....
+Data stack: ( v1 v2 -- v3 )
+....
+
+"MAX" is a function word that selects the greatest of v1 and v2. To
+that end, the values are 64-bit signed integers.
--- /dev/null
+// math.asm: WORD p_min, 'MIN',fasm
+
+anchor:p_min[]
+
+=== Word: MIN
+
+....
+Data stack: ( v1 v2 -- v3 )
+....
+
+"MIN" is a function word that selects the least of v1 and v2. To that
+end, the values are 64-bit signed integers.
p_abs_end:
next
+ WORD p_max, 'MAX',fasm
+ ;; ( a b -- c )
+ ;; c is the least a and b
+ pop rax
+ cmp rax,qword [rsp]
+ jle p_max_end
+ mov qword [rsp],rax
+p_max_end:
+ next
+
+ WORD p_min, 'MIN',fasm
+ ;; ( a b -- c )
+ ;; c is the least a and b
+ pop rax
+ cmp rax,qword [rsp]
+ jge p_min_end
+ mov qword [rsp],rax
+p_min_end:
+ next
+
WORD p_negate, 'NEGATE',fasm
;; ( n1 -- n2 )
;; Negate n1, giving its arithmetic inverse n2.
include::separator.adoc[]
include::adoc/p_malloc.adoc[]
include::separator.adoc[]
+include::adoc/p_max.adoc[]
+include::separator.adoc[]
+include::adoc/p_min.adoc[]
+include::separator.adoc[]
include::adoc/p_minus.adoc[]
include::separator.adoc[]
include::adoc/p_mult.adoc[]
xref:p_args[MAIN-ARGS] {nbsp}
xref:p_malloc[MALLOC] {nbsp}
+xref:p_min[MIN] {nbsp}
+xref:p_max[MAX] {nbsp}
xref:p_negate[NEGATE] {nbsp}
xref:p_nip[NIP] {nbsp}