scripts: kconfig: Add min/max functions
Similar to arithmetic functions, min/max can be useful to use in kconfig. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
1e6f39e91b
commit
2f234c627c
1 changed files with 6 additions and 0 deletions
|
|
@ -963,6 +963,10 @@ def arith(kconf, name, *args):
|
||||||
return str(int(functools.reduce(operator.truediv, intarray)))
|
return str(int(functools.reduce(operator.truediv, intarray)))
|
||||||
elif name == "mod":
|
elif name == "mod":
|
||||||
return str(int(functools.reduce(operator.mod, intarray)))
|
return str(int(functools.reduce(operator.mod, intarray)))
|
||||||
|
elif name == "max":
|
||||||
|
return str(int(functools.reduce(max, intarray)))
|
||||||
|
elif name == "min":
|
||||||
|
return str(int(functools.reduce(min, intarray)))
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
|
@ -1046,6 +1050,8 @@ functions = {
|
||||||
"mul": (arith, 1, 255),
|
"mul": (arith, 1, 255),
|
||||||
"div": (arith, 1, 255),
|
"div": (arith, 1, 255),
|
||||||
"mod": (arith, 1, 255),
|
"mod": (arith, 1, 255),
|
||||||
|
"max": (arith, 1, 255),
|
||||||
|
"min": (arith, 1, 255),
|
||||||
"inc": (inc_dec, 1, 255),
|
"inc": (inc_dec, 1, 255),
|
||||||
"dec": (inc_dec, 1, 255),
|
"dec": (inc_dec, 1, 255),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue