Skip to content

Commit dfb7fc2

Browse files
committed
rtl8733b: avoid Windows min/max macros
1 parent f9388fa commit dfb7fc2

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎src/rtl8733b/FrameParser8733b.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ inline uint32_t rx_le32(const uint8_t *p) {
1919
}
2020

2121
inline uint32_t rx_bits(const uint8_t *p, unsigned bit, unsigned width) {
22-
const uint32_t mask = width == 32 ? std::numeric_limits<uint32_t>::max()
22+
const uint32_t mask = width == 32 ? (std::numeric_limits<uint32_t>::max)()
2323
: ((1u << width) - 1u);
2424
return (rx_le32(p) >> bit) & mask;
2525
}
@@ -98,7 +98,7 @@ inline bool parse_rx_8733b(const uint8_t *buf, size_t buflen,
9898
static_cast<uint32_t>(out.drvinfo_size) + out.shift;
9999
const uint64_t end = frame_offset + out.frame_len;
100100
if (out.frame_len == 0 || frame_offset > buflen || end > buflen ||
101-
end > std::numeric_limits<uint32_t>::max())
101+
end > (std::numeric_limits<uint32_t>::max)())
102102
return false;
103103

104104
out.frame = buf + static_cast<size_t>(frame_offset);

‎src/rtl8733b/Phy8733b.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Phy8733b::tssi_de_plan(const TssiPowerInfo8733b &power, uint8_t channel) {
344344
};
345345
auto subtract_two = [](int8_t value) {
346346
return static_cast<int8_t>(
347-
std::max(-128, static_cast<int>(value) - 2));
347+
(std::max)(-128, static_cast<int>(value) - 2));
348348
};
349349

350350
TssiDePlan8733b plan;
@@ -432,7 +432,8 @@ Phy8733b::tssi_rate_offsets(const TxPowerTargets8733b &targets, uint8_t band,
432432
return std::nullopt;
433433
}
434434
offsets[rate] = static_cast<int8_t>(std::clamp(
435-
static_cast<int>(std::min(target, max_target_qdbm)) - 64, -128, 127));
435+
static_cast<int>((std::min)(target, max_target_qdbm)) - 64, -128,
436+
127));
436437
}
437438
return offsets;
438439
}
@@ -492,11 +493,12 @@ TssiThermalPlan8733b Phy8733b::tssi_thermal_plan(uint8_t efuse_thermal,
492493
return index < 18 ? 0 : index < 20 ? 3 : 5;
493494
};
494495
for (size_t i = 0; i < 32; ++i)
495-
signed_offsets[i] = static_cast<int8_t>(-swing(std::min(i, size_t{29})));
496+
signed_offsets[i] =
497+
static_cast<int8_t>(-swing((std::min)(i, size_t{29})));
496498
size_t swing_index = 1;
497499
for (int i = 63; i >= 32; --i) {
498500
signed_offsets[static_cast<size_t>(i)] =
499-
swing(std::min(swing_index, size_t{29}));
501+
swing((std::min)(swing_index, size_t{29}));
500502
++swing_index;
501503
}
502504
for (size_t word = 0; word < plan.offsets.size(); ++word) {

‎src/rtl8733b/Rtl8733bBringup.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ bool Rtl8733bBringup::dlfw_to_mem(const uint8_t *fw, uint32_t src,
417417
uint32_t offset = 0;
418418
bool first = true;
419419
while (offset < size) {
420-
const uint32_t chunk = std::min(FW_PACKET_SIZE, size - offset);
420+
const uint32_t chunk = (std::min)(FW_PACKET_SIZE, size - offset);
421421
if (!send_fw_page(static_cast<uint16_t>(src >> 7), fw + offset, chunk))
422422
return false;
423423
if (!iddma(OCPBASE_TXBUF + src + TXDESC_SIZE, dest + offset, chunk,

0 commit comments

Comments
 (0)