@@ -603,22 +603,20 @@ namespace antithesis {
603
603
get_lib_handler ().output (catalog);
604
604
}
605
605
606
- std::pair<NumericValue, bool > compute_half_gap (Value value) {
607
- NumericValue left = value.first ;
608
- NumericValue right = value.second ;
606
+ std::pair<NumericValue, bool > compute_half_gap (NumericValue left, NumericValue right) {
609
607
// An extremely baroque way to compute (left - right) / 2, rounded toward 0, without overflowing or underflowing
610
608
if (std::is_integral_v<NumericValue>) {
611
609
// If both numbers are odd then the gap doesn't change if we subtract 1 from both sides
612
610
// Also subtracting 1 from both sides won't underflow
613
611
if (left % 2 == 1 && right % 2 == 1 )
614
- return compute_half_gap ({ left - 1 , right - 1 } );
612
+ return compute_half_gap ( left - 1 , right - 1 );
615
613
// If one number is odd then we subtract 1 from the larger number
616
614
// This rounds the computation toward 0 but again won't underflow
617
615
if (left % 2 == 1 || right % 2 == 1 ) {
618
616
if (left > right) {
619
- return compute_half_gap ({ left - 1 , right } );
617
+ return compute_half_gap ( left - 1 , right );
620
618
} else {
621
- return compute_half_gap ({ left, right - 1 } );
619
+ return compute_half_gap ( left, right - 1 ` );
622
620
}
623
621
}
624
622
// At this point both numbers are even, so the midpoint calculation is exact
@@ -671,7 +669,7 @@ namespace antithesis {
671
669
}
672
670
673
671
[[clang::always_inline]] inline void send_guidance (Value value) {
674
- std::pair<NumericValue, bool > half_gap = compute_half_gap (value);
672
+ std::pair<NumericValue, bool > half_gap = compute_half_gap (value. first , value. second );
675
673
if (should_send_value (half_gap)) {
676
674
extreme_half_gap = half_gap;
677
675
std::string id = make_key (this ->message , this ->location );
0 commit comments