Add a rule to get numbers greater or equal to a minimum number.

Cherry-pick from b235859ac0

Bug: 171217392
Test: Make
Change-Id: I04df72f813f892f0b6dec8b48e2a113af4545148
Merged-In: I04df72f813f892f0b6dec8b48e2a113af4545148
This commit is contained in:
yawanng 2020-10-27 01:48:41 +00:00 committed by Yan Wang
parent 67e1341100
commit 522710f378
1 changed files with 16 additions and 0 deletions

View File

@ -181,6 +181,22 @@ $(call math-expect,(call numbers_less_than,3,0 2 1 3),0 2 1)
$(call math-expect,(call numbers_less_than,4,0 2 1 3),0 2 1 3)
$(call math-expect,(call numbers_less_than,3,0 2 1 3 2),0 2 1 2)
# Returns the words in $2 that are numbers and are greater or equal to $1
define numbers_greater_or_equal_to
$(strip \
$(foreach n,$2, \
$(if $(call math_is_number,$(n)), \
$(if $(call math_gt_or_eq,$(n),$(1)), \
$(n)))))
endef
$(call math-expect,(call numbers_greater_or_equal_to,4,0 1 2 3),)
$(call math-expect,(call numbers_greater_or_equal_to,3,0 2 1 3),3)
$(call math-expect,(call numbers_greater_or_equal_to,2,0 2 1 3),2 3)
$(call math-expect,(call numbers_greater_or_equal_to,1,0 2 1 3),2 1 3)
$(call math-expect,(call numbers_greater_or_equal_to,0,0 2 1 3),0 2 1 3)
$(call math-expect,(call numbers_greater_or_equal_to,1,0 2 1 3 2),2 1 3 2)
_INT_LIMIT_WORDS := $(foreach a,x x,$(foreach b,x x x x x x x x x x x x x x x x,\
$(foreach c,x x x x x x x x x x x x x x x x,x x x x x x x x x x x x x x x x)))