<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Dec 14, 2010, at 11:12 PM, Rafael Espindola wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: rafael<br>Date: Wed Dec 15 01:12:24 2010<br>New Revision: 121851<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=121851&view=rev">http://llvm.org/viewvc/llvm-project?rev=121851&view=rev</a><br>Log:<br>Generalize an assert.<br><br>Modified:<br> llvm/trunk/include/llvm/Support/MathExtras.h<br> llvm/trunk/lib/MC/MCStreamer.cpp<br><br>Modified: llvm/trunk/include/llvm/Support/MathExtras.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MathExtras.h?rev=121851&r1=121850&r2=121851&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MathExtras.h?rev=121851&r1=121850&r2=121851&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/Support/MathExtras.h (original)<br>+++ llvm/trunk/include/llvm/Support/MathExtras.h Wed Dec 15 01:12:24 2010<br>@@ -76,6 +76,12 @@<br> return x == (x & (~0ULL >> (64 - N)));<br> }<br><br>+/// isIIntN - Checks if an signed integer fits into the given (dynamic)<br></div></blockquote><div><br></div><div>"isIIntN" is a typo.</div><div><br></div><div>-bw</div><br><blockquote type="cite"><div>+/// bit width.<br>+inline bool isIntN(unsigned N, int64_t x) {<br>+ return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));<br>+}<br>+<br> /// isMask_32 - This function returns true if the argument is a sequence of ones<br> /// starting at the least significant bit with the remainder zero (32 bit<br> /// version). Ex. isMask_32(0x0000FFFFU) == true.<br><br>Modified: llvm/trunk/lib/MC/MCStreamer.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=121851&r1=121850&r2=121851&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=121851&r1=121850&r2=121851&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/MC/MCStreamer.cpp (original)<br>+++ llvm/trunk/lib/MC/MCStreamer.cpp Wed Dec 15 01:12:24 2010<br>@@ -48,7 +48,8 @@<br> void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size,<br> unsigned AddrSpace) {<br> assert(Size <= 8 && "Invalid size");<br>- assert(!(Size == 1 && (signed)Value > 255) && "Invalid size");<br>+ unsigned Bits = 8 * Size;<br>+ assert((isUIntN(Bits, Value) || isIntN(Bits, Value)) && "Invalid size");<br> char buf[8];<br> // FIXME: Endianness assumption.<br> for (unsigned i = 0; i != Size; ++i)<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></div></blockquote></div><br></body></html>