[llvm] r260067 - [Support] Fix the examples and assertion for format_hex_no_prefix to take into account that there are no prefix characters to include in Width.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 7 17:02:55 PST 2016


Author: ctopper
Date: Sun Feb  7 19:02:55 2016
New Revision: 260067

URL: http://llvm.org/viewvc/llvm-project?rev=260067&view=rev
Log:
[Support] Fix the examples and assertion for format_hex_no_prefix to take into account that there are no prefix characters to include in Width.

Modified:
    llvm/trunk/include/llvm/Support/Format.h

Modified: llvm/trunk/include/llvm/Support/Format.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Format.h?rev=260067&r1=260066&r2=260067&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Format.h (original)
+++ llvm/trunk/include/llvm/Support/Format.h Sun Feb  7 19:02:55 2016
@@ -170,13 +170,13 @@ inline FormattedNumber format_hex(uint64
 /// format_hex_no_prefix - Output \p N as a fixed width hexadecimal. Does not
 /// prepend '0x' to the outputted string.  If number will not fit in width,
 /// full number is still printed.  Examples:
-///   OS << format_hex_no_prefix(255, 4)              => ff
-///   OS << format_hex_no_prefix(255, 4, true)        => FF
-///   OS << format_hex_no_prefix(255, 6)              => 00ff
 ///   OS << format_hex_no_prefix(255, 2)              => ff
+///   OS << format_hex_no_prefix(255, 2, true)        => FF
+///   OS << format_hex_no_prefix(255, 4)              => 00ff
+///   OS << format_hex_no_prefix(255, 1)              => ff
 inline FormattedNumber format_hex_no_prefix(uint64_t N, unsigned Width,
                                             bool Upper = false) {
-  assert(Width <= 18 && "hex width must be <= 18");
+  assert(Width <= 16 && "hex width must be <= 16");
   return FormattedNumber(N, 0, Width, true, Upper, false);
 }
 




More information about the llvm-commits mailing list