[cfe-commits] Patch for packed enums

Eli Friedman eli.friedman at gmail.com
Sat Aug 1 13:06:13 PDT 2009


Sorry for the delay.

+    // If it's packed, check if it fits a char or short.
+    if (Packed && NumNegativeBits <= CharWidth && NumPositiveBits <
CharWidth) {
+        BestType = Context.SignedCharTy;
+        BestWidth = CharWidth;
+    } else if (Packed && NumNegativeBits <= ShortWidth &&
NumPositiveBits < ShortWidth) {
+        BestType = Context.ShortTy;
+        BestWidth = ShortWidth;
+    }
     // If there is a negative value, figure out the smallest integer type (of
     // int/long/longlong) that fits.
-    if (NumNegativeBits <= IntWidth && NumPositiveBits < IntWidth) {
+    else if (NumNegativeBits <= IntWidth && NumPositiveBits < IntWidth) {

Having a comment in the middle of the if statement is a bit awkward;
it would be nice to merge the two comments.

Otherwise, looks fine.

-Eli

On Sat, Aug 1, 2009 at 12:26 PM, Anders Johnsen<skabet at gmail.com> wrote:
> Bump :)
>
> On Sun, Jul 26, 2009 at 23:52, Anders Johnsen <skabet at gmail.com> wrote:
>>
>> Hi,
>>
>> This patch should implement packed enums (PR4098).
>>
>> - Anders
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>



More information about the cfe-commits mailing list