@@ -737,7 +737,7 @@ static inline bool zend_abs_range(
737737 zend_long min , zend_long max , zend_long * abs_min , zend_long * abs_max ) {
738738 if (min == ZEND_LONG_MIN ) {
739739 /* Cannot take absolute value of LONG_MIN */
740- return 0 ;
740+ return false ;
741741 }
742742
743743 if (min >= 0 ) {
@@ -752,7 +752,7 @@ static inline bool zend_abs_range(
752752 * abs_max = MAX (max , - min );
753753 }
754754
755- return 1 ;
755+ return true ;
756756}
757757
758758static inline zend_long safe_shift_left (zend_long n , zend_long s ) {
@@ -809,7 +809,7 @@ static bool zend_inference_calc_binary_op_range(
809809 } else {
810810 tmp -> max = op1_max + op2_max ;
811811 }
812- return 1 ;
812+ return true ;
813813 }
814814 break ;
815815 case ZEND_SUB :
@@ -834,7 +834,7 @@ static bool zend_inference_calc_binary_op_range(
834834 } else {
835835 tmp -> max = op1_max - op2_min ;
836836 }
837- return 1 ;
837+ return true ;
838838 }
839839 break ;
840840 case ZEND_MUL :
@@ -867,7 +867,7 @@ static bool zend_inference_calc_binary_op_range(
867867 tmp -> min = MIN (MIN (t1 , t2 ), MIN (t3 , t4 ));
868868 tmp -> max = MAX (MAX (t1 , t2 ), MAX (t3 , t4 ));
869869 }
870- return 1 ;
870+ return true ;
871871 }
872872 break ;
873873 case ZEND_DIV :
@@ -899,7 +899,7 @@ static bool zend_inference_calc_binary_op_range(
899899 tmp -> min = MIN (MIN (MIN (t1 , t2 ), MIN (t3 , t4 )), MIN (MIN (t1_ , t2_ ), MIN (t3_ , t4_ )));
900900 tmp -> max = MAX (MAX (MAX (t1 , t2 ), MAX (t3 , t4 )), MAX (MAX (t1_ , t2_ ), MAX (t3_ , t4_ )));
901901 }
902- return 1 ;
902+ return true ;
903903 }
904904 break ;
905905 case ZEND_MOD :
@@ -941,7 +941,7 @@ static bool zend_inference_calc_binary_op_range(
941941 tmp -> max = MIN (op1_max , op2_abs_max - 1 );
942942 }
943943 }
944- return 1 ;
944+ return true ;
945945 }
946946 break ;
947947 case ZEND_SL :
@@ -979,7 +979,7 @@ static bool zend_inference_calc_binary_op_range(
979979 tmp -> max = MAX (MAX (t1 , t2 ), MAX (t3 , t4 ));
980980 }
981981 }
982- return 1 ;
982+ return true ;
983983 }
984984 break ;
985985 case ZEND_SR :
@@ -1019,7 +1019,7 @@ static bool zend_inference_calc_binary_op_range(
10191019 tmp -> min = MIN (MIN (t1 , t2 ), MIN (t3 , t4 ));
10201020 tmp -> max = MAX (MAX (t1 , t2 ), MAX (t3 , t4 ));
10211021 }
1022- return 1 ;
1022+ return true ;
10231023 }
10241024 break ;
10251025 case ZEND_BW_OR :
@@ -1037,7 +1037,7 @@ static bool zend_inference_calc_binary_op_range(
10371037 op2_max = OP2_MAX_RANGE ();
10381038 zend_ssa_range_or (op1_min , op1_max , op2_min , op2_max , tmp );
10391039 }
1040- return 1 ;
1040+ return true ;
10411041 }
10421042 break ;
10431043 case ZEND_BW_AND :
@@ -1055,15 +1055,15 @@ static bool zend_inference_calc_binary_op_range(
10551055 op2_max = OP2_MAX_RANGE ();
10561056 zend_ssa_range_and (op1_min , op1_max , op2_min , op2_max , tmp );
10571057 }
1058- return 1 ;
1058+ return true ;
10591059 }
10601060 break ;
10611061 case ZEND_BW_XOR :
10621062 // TODO
10631063 break ;
10641064 default : ZEND_UNREACHABLE ();
10651065 }
1066- return 0 ;
1066+ return false ;
10671067}
10681068
10691069static bool zend_inference_calc_range (const zend_op_array * op_array , const zend_ssa * ssa , int var , int widening , bool narrowing , zend_ssa_range * tmp )
@@ -1237,7 +1237,7 @@ static bool zend_inference_calc_range(const zend_op_array *op_array, const zend_
12371237 }
12381238 return (tmp -> min <= tmp -> max );
12391239 } else if (ssa -> vars [var ].definition < 0 ) {
1240- return 0 ;
1240+ return false ;
12411241 }
12421242 line = ssa -> vars [var ].definition ;
12431243 opline = op_array -> opcodes + line ;
@@ -1635,11 +1635,11 @@ static bool zend_inference_widening_meet(zend_ssa_var_info *var_info, zend_ssa_r
16351635 var_info -> range .max == r -> max &&
16361636 var_info -> range .underflow == r -> underflow &&
16371637 var_info -> range .overflow == r -> overflow ) {
1638- return 0 ;
1638+ return false ;
16391639 }
16401640 }
16411641 var_info -> range = * r ;
1642- return 1 ;
1642+ return true ;
16431643}
16441644
16451645static bool zend_ssa_range_widening (const zend_op_array * op_array , const zend_ssa * ssa , int var , int scc )
@@ -1649,10 +1649,10 @@ static bool zend_ssa_range_widening(const zend_op_array *op_array, const zend_ss
16491649 if (zend_inference_calc_range (op_array , ssa , var , 1 , 0 , & tmp )) {
16501650 if (zend_inference_widening_meet (& ssa -> var_info [var ], & tmp )) {
16511651 LOG_SSA_RANGE (" change range (widening SCC %2d) %2d [%s%ld..%ld%s]\n" , scc , var , (tmp .underflow ?"-- " :"" ), tmp .min , tmp .max , (tmp .overflow ?" ++" :"" ));
1652- return 1 ;
1652+ return true ;
16531653 }
16541654 }
1655- return 0 ;
1655+ return false ;
16561656}
16571657
16581658static bool zend_inference_narrowing_meet (zend_ssa_var_info * var_info , zend_ssa_range * r )
@@ -1680,11 +1680,11 @@ static bool zend_inference_narrowing_meet(zend_ssa_var_info *var_info, zend_ssa_
16801680 var_info -> range .max == r -> max &&
16811681 var_info -> range .underflow == r -> underflow &&
16821682 var_info -> range .overflow == r -> overflow ) {
1683- return 0 ;
1683+ return false ;
16841684 }
16851685 }
16861686 var_info -> range = * r ;
1687- return 1 ;
1687+ return true ;
16881688}
16891689
16901690static bool zend_ssa_range_narrowing (const zend_op_array * op_array , const zend_ssa * ssa , int var , int scc )
@@ -1694,10 +1694,10 @@ static bool zend_ssa_range_narrowing(const zend_op_array *op_array, const zend_s
16941694 if (zend_inference_calc_range (op_array , ssa , var , 0 , 1 , & tmp )) {
16951695 if (zend_inference_narrowing_meet (& ssa -> var_info [var ], & tmp )) {
16961696 LOG_SSA_RANGE (" change range (narrowing SCC %2d) %2d [%s%ld..%ld%s]\n" , scc , var , (tmp .underflow ?"-- " :"" ), tmp .min , tmp .max , (tmp .overflow ?" ++" :"" ));
1697- return 1 ;
1697+ return true ;
16981698 }
16991699 }
1700- return 0 ;
1700+ return false ;
17011701}
17021702
17031703#ifdef NEG_RANGE
@@ -1714,12 +1714,12 @@ static bool zend_ssa_range_narrowing(const zend_op_array *op_array, const zend_s
17141714static bool zend_check_inner_cycles (const zend_op_array * op_array , zend_ssa * ssa , zend_bitset worklist , zend_bitset visited , int var )
17151715{
17161716 if (zend_bitset_in (worklist , var )) {
1717- return 1 ;
1717+ return true ;
17181718 }
17191719 zend_bitset_incl (worklist , var );
17201720 FOR_EACH_VAR_USAGE (var , CHECK_INNER_CYCLE );
17211721 zend_bitset_incl (visited , var );
1722- return 0 ;
1722+ return false ;
17231723}
17241724#endif
17251725
@@ -2514,11 +2514,11 @@ static bool result_may_be_separated(const zend_ssa *ssa, const zend_ssa_op *ssa_
25142514 if (use_op == ssa_op + 1 ) {
25152515 if ((use_op -> op1_use == tmp_var && use_op -> op1_use_chain < 0 )
25162516 || (use_op -> op2_use == tmp_var && use_op -> op2_use_chain < 0 )) {
2517- return 0 ;
2517+ return false ;
25182518 }
25192519 }
25202520 }
2521- return 1 ;
2521+ return true ;
25222522}
25232523
25242524static zend_always_inline zend_result _zend_update_type_info (
@@ -4174,11 +4174,11 @@ static zend_class_entry *join_class_entries(
41744174
41754175static bool safe_instanceof (const zend_class_entry * ce1 , const zend_class_entry * ce2 ) {
41764176 if (ce1 == ce2 ) {
4177- return 1 ;
4177+ return true ;
41784178 }
41794179 if (!(ce1 -> ce_flags & ZEND_ACC_LINKED )) {
41804180 /* This case could be generalized, similarly to unlinked_instanceof */
4181- return 0 ;
4181+ return false ;
41824182 }
41834183 return instanceof_function (ce1 , ce2 );
41844184}
@@ -4315,7 +4315,7 @@ static bool can_convert_to_double(
43154315 uint32_t type ;
43164316
43174317 if (zend_bitset_in (visited , var_num )) {
4318- return 1 ;
4318+ return true ;
43194319 }
43204320 zend_bitset_incl (visited , var_num );
43214321
@@ -4328,7 +4328,7 @@ static bool can_convert_to_double(
43284328 }
43294329
43304330 if (!is_narrowable_instr (opline )) {
4331- return 0 ;
4331+ return false ;
43324332 }
43334333
43344334 /* Instruction always returns double, the conversion is certainly fine */
@@ -4340,12 +4340,12 @@ static bool can_convert_to_double(
43404340 /* UNDEF signals that the previous result is an effective double cast, this is only allowed
43414341 * if this instruction would have done the cast anyway (previous check). */
43424342 if (Z_ISUNDEF_P (value )) {
4343- return 0 ;
4343+ return false ;
43444344 }
43454345
43464346 /* Check that narrowing can actually be useful */
43474347 if ((type & MAY_BE_ANY ) & ~(MAY_BE_LONG |MAY_BE_DOUBLE )) {
4348- return 0 ;
4348+ return false ;
43494349 }
43504350
43514351 {
@@ -4387,15 +4387,15 @@ static bool can_convert_to_double(
43874387 } else if (is_effective_op1_double_cast (opline , & orig_op2 )) {
43884388 ZVAL_UNDEF (& orig_result );
43894389 } else {
4390- return 0 ;
4390+ return false ;
43914391 }
43924392 } else if (Z_ISUNDEF (orig_op2 )) {
43934393 if (opline -> opcode == ZEND_MUL && Z_LVAL (orig_op1 ) == 0 ) {
43944394 ZVAL_LONG (& orig_result , 0 );
43954395 } else if (is_effective_op2_double_cast (opline , & orig_op1 )) {
43964396 ZVAL_UNDEF (& orig_result );
43974397 } else {
4398- return 0 ;
4398+ return false ;
43994399 }
44004400 } else {
44014401 uint8_t opcode = opline -> opcode ;
@@ -4406,19 +4406,19 @@ static bool can_convert_to_double(
44064406
44074407 /* Avoid division by zero */
44084408 if (opcode == ZEND_DIV && zval_get_double (& orig_op2 ) == 0.0 ) {
4409- return 0 ;
4409+ return false ;
44104410 }
44114411
44124412 get_binary_op (opcode )(& orig_result , & orig_op1 , & orig_op2 );
44134413 get_binary_op (opcode )(& dval_result , & dval_op1 , & dval_op2 );
44144414 ZEND_ASSERT (Z_TYPE (dval_result ) == IS_DOUBLE );
44154415 if (zval_get_double (& orig_result ) != Z_DVAL (dval_result )) {
4416- return 0 ;
4416+ return false ;
44174417 }
44184418 }
44194419
44204420 if (!can_convert_to_double (op_array , ssa , ssa_op -> result_def , & orig_result , visited )) {
4421- return 0 ;
4421+ return false ;
44224422 }
44234423 }
44244424 }
@@ -4427,15 +4427,15 @@ static bool can_convert_to_double(
44274427 /* Check that narrowing can actually be useful */
44284428 type = ssa -> var_info [phi -> ssa_var ].type ;
44294429 if ((type & MAY_BE_ANY ) & ~(MAY_BE_LONG |MAY_BE_DOUBLE )) {
4430- return 0 ;
4430+ return false ;
44314431 }
44324432
44334433 if (!can_convert_to_double (op_array , ssa , phi -> ssa_var , value , visited )) {
4434- return 0 ;
4434+ return false ;
44354435 }
44364436 }
44374437
4438- return 1 ;
4438+ return true ;
44394439}
44404440
44414441static zend_result zend_type_narrowing (const zend_op_array * op_array , const zend_script * script , zend_ssa * ssa , zend_long optimization_level )
@@ -4504,11 +4504,11 @@ static bool is_recursive_tail_call(const zend_op_array *op_array, const zend_op
45044504 if (op -> opcode == ZEND_DO_UCALL ) {
45054505 const zend_call_info * call_info = info -> call_map [op - op_array -> opcodes ];
45064506 if (call_info && op_array == & call_info -> callee_func -> op_array ) {
4507- return 1 ;
4507+ return true ;
45084508 }
45094509 }
45104510 }
4511- return 0 ;
4511+ return false ;
45124512}
45134513
45144514uint32_t zend_get_return_info_from_signature_only (
0 commit comments