mirror of
https://github.com/fmtlib/fmt.git
synced 2026-07-31 00:36:58 +08:00
fix: use logical AND instead of bitwise AND in endpoint check
Both operands (`z_mul.is_integer` and `include_right_endpoint`) are boolean types, making logical AND (`&&`) the semantically correct choice over bitwise AND (`&`). Using `&&` ensures proper short-circuit evaluation and prevents latent logic bugs if these variables are refactored into integral types or bitmasks in the future. Signed-off-by: Yuming He <ComixHe1895@outlook.com>
This commit is contained in:
parent
588b3a0f8f
commit
4379eaabd3
@ -1338,7 +1338,7 @@ template <typename T> auto to_decimal(T x) noexcept -> decimal_fp<T> {
|
||||
|
||||
if (r < deltai) {
|
||||
// Exclude the right endpoint if necessary.
|
||||
if (r == 0 && (z_mul.is_integer & !include_right_endpoint)) {
|
||||
if (r == 0 && (z_mul.is_integer && !include_right_endpoint)) {
|
||||
--ret_value.significand;
|
||||
r = float_info<T>::big_divisor;
|
||||
goto small_divisor_case_label;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user