mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	Generalize an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121851 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -76,6 +76,12 @@ inline bool isUIntN(unsigned N, uint64_t x) { | |||||||
|   return x == (x & (~0ULL >> (64 - N))); |   return x == (x & (~0ULL >> (64 - N))); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /// isIIntN - Checks if an signed integer fits into the given (dynamic) | ||||||
|  | /// bit width. | ||||||
|  | inline bool isIntN(unsigned N, int64_t x) { | ||||||
|  |   return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1))); | ||||||
|  | } | ||||||
|  |  | ||||||
| /// isMask_32 - This function returns true if the argument is a sequence of ones | /// isMask_32 - This function returns true if the argument is a sequence of ones | ||||||
| /// starting at the least significant bit with the remainder zero (32 bit | /// starting at the least significant bit with the remainder zero (32 bit | ||||||
| /// version).   Ex. isMask_32(0x0000FFFFU) == true. | /// version).   Ex. isMask_32(0x0000FFFFU) == true. | ||||||
|   | |||||||
| @@ -48,7 +48,8 @@ void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta, | |||||||
| void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size, | void MCStreamer::EmitIntValue(uint64_t Value, unsigned Size, | ||||||
|                               unsigned AddrSpace) { |                               unsigned AddrSpace) { | ||||||
|   assert(Size <= 8 && "Invalid size"); |   assert(Size <= 8 && "Invalid size"); | ||||||
|   assert(!(Size == 1 && (signed)Value > 255) && "Invalid size"); |   unsigned Bits = 8 * Size; | ||||||
|  |   assert((isUIntN(Bits, Value) || isIntN(Bits, Value)) && "Invalid size"); | ||||||
|   char buf[8]; |   char buf[8]; | ||||||
|   // FIXME: Endianness assumption. |   // FIXME: Endianness assumption. | ||||||
|   for (unsigned i = 0; i != Size; ++i) |   for (unsigned i = 0; i != Size; ++i) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user