diff options
Diffstat (limited to 'kbruch/src/task.cpp')
-rw-r--r-- | kbruch/src/task.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/kbruch/src/task.cpp b/kbruch/src/task.cpp index 50cd2f28..1ebd13e9 100644 --- a/kbruch/src/task.cpp +++ b/kbruch/src/task.cpp @@ -45,18 +45,18 @@ task::~task() * can be customized by the given parameters: * pmax_md: maximum main denominator * pnr_ratios: number of ratios -> pnr_ratios - 1 operations - * padd_sub: if TRUE + and - are allowed operations - * pmul_div: if TRUE * and / are allowed operations */ + * padd_sub: if true + and - are allowed operations + * pmul_div: if true * and / are allowed operations */ void task::create_task(unsigned int pmax_md, short pnr_ratios, - short padd_sub, short pmul_div) + bool padd_sub, bool pmul_div) { unsigned short max_product_length = 0; int main_denominator = 1; /* we say that if add/sub and mul/div are not allowed we want a task * for add/sub only */ - if (padd_sub == NO && pmul_div == NO) - padd_sub = YES; + if (!padd_sub && !pmul_div) + padd_sub = true; do { @@ -395,9 +395,9 @@ unsigned short task::make_operation(short padd_sub, short pmul_div, ShortArray::iterator op_pointer; /* we need this to generate the fitting operations */ - if (padd_sub == YES) + if (padd_sub) operations += 2; - if (pmul_div == YES) + if (pmul_div) operations += 2; /* clear the old operations */ @@ -409,7 +409,7 @@ unsigned short task::make_operation(short padd_sub, short pmul_div, /* if we only wanted mul/div, operations was 2; but we want values * for the operations with 2 and 3 so we have to add 2 */ - if (padd_sub == NO && pmul_div == YES) + if (!padd_sub && pmul_div) { /* loop through all operations and add 2, so that the operations * are interpreted as mul/div and not add/sub */ @@ -418,7 +418,7 @@ unsigned short task::make_operation(short padd_sub, short pmul_div, *op_pointer += 2; } - if (pmul_div == YES) + if (pmul_div) { short flag_counter = 0; @@ -453,13 +453,13 @@ unsigned short task::make_operation(short padd_sub, short pmul_div, max_product_length++; } else - { /* if (pmul_div == YES) */ + { /* if (pmul_div) */ /* a task is given only with add/sub ops; so we want a max. * of pnr_ratios / 2 + 1 prime factors, but at least */ max_product_length = (unsigned short) (float(pnr_ratios) / 2) + 1; if (max_product_length < 2) max_product_length = 2; - } /* if (pmul_div == YES) */ + } /* if (pmul_div) */ return max_product_length; } @@ -580,7 +580,7 @@ void task::make_denominators(int main_denominator, short pmax_md, /* if the ratio is connected to a mul or div operation, we have to do some * extra work and regenerate the denominators */ - if (pmul_div == YES) + if (pmul_div) { /* lets loop through all ratios and check, if there is a mul/div * after the ratio */ @@ -697,7 +697,7 @@ void task::make_denominators(int main_denominator, short pmax_md, } ratio_pointer++; } - } /* if (pmul_div == YES) */ + } /* if (pmul_div) */ return; } |