Skip to content

Commit 3c7ad28

Browse files
committed
lex operation
1 parent cbabe6a commit 3c7ad28

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec.markdown

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ This document is organized as follows:
3333
* [`mod` (Modulus)](#mod)
3434
* [`pow` (Power)](#pow)
3535
* [`gcd` (Greatest Common Divisor)](#gcd)
36+
* [`lex` (Largest Exponent)](#lex)
3637
* [`bin` (Binomial Coefficient)](#bin)
3738
* [`log` (Logarithm)](#log)
3839
* [`nrt` (n-th Root)](#nrt)
@@ -280,6 +281,24 @@ gcd $0,$1 ; $0 := 4
280281
gcd $0,5 ; $0 := 1
281282
```
282283

284+
<a name="lex"/>
285+
286+
## **lex** (Largest Exponent)
287+
288+
Largest exponent of the source dividing the target.
289+
Greatest common divisor of target and source.
290+
291+
An operation `lex a,b` computes the largest exponent of `b` that divides `a`, and assigns it to `a`. The result is always a non-negtive number. If `a` is zero or `b` is zero or `b` is one, the result is always zero.
292+
293+
Examples:
294+
295+
```asm
296+
mov $0,18 ; $0 := 9
297+
lex $0,3 ; $0 := 2
298+
mov $0,-8 ; $0 := 9
299+
lex $0,2 ; $0 := 4
300+
```
301+
283302
<a name="bin"/>
284303

285304
## **bin** (Binomial Coefficient)

0 commit comments

Comments
 (0)