[llvm] [ADT, Support] Use std::min and std::max (NFC) (PR #164145)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 19 09:26:19 PDT 2025


================
@@ -236,8 +236,7 @@ class FormattedBytes {
       : Bytes(B), FirstByteOffset(O), IndentLevel(IL), NumPerLine(NPL),
         ByteGroupSize(BGS), Upper(U), ASCII(A) {
 
-    if (ByteGroupSize > NumPerLine)
-      ByteGroupSize = NumPerLine;
+    ByteGroupSize = std::min<uint32_t>(ByteGroupSize, NumPerLine);
----------------
kazutakahirata wrote:

Thanks for the review!  I think I'm going to drop the `Format.h` bits.  I considered:

```
ByteGroupSize = std::min(static_cast<uint32_t>(ByteGroupSize), NumPerLine);
```

but it looks a bit uglier than the `if` statement.


https://github.com/llvm/llvm-project/pull/164145


More information about the llvm-commits mailing list