[Webkit-unassigned] [Bug 54807] Always explicitly use "signed" keyword to declare signed bitfields

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 23 14:02:08 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=54807





--- Comment #20 from Yong Li <yong.li.webkit at gmail.com>  2011-02-23 14:02:08 PST ---
(In reply to comment #19)
> Weird. May compilers do the same for signed/unsigned? I'm wondering if it would be safer to change all int bitfields to signed then.

int => signed should be no-op if int is treated as signed.

Results on VC
struct {
unsigned x:30;
signed y:2;
};
sizeof = 4.

struct {
unsigned x:30;
short y:2;
};
sizeof = 8.

So basically when x and y's base types have same size, they are packed. When x and y's base types have different size, VC doesn't pack them.

so all bitfields that are supposed to be packed should have same sized base types. it doesn't matter it is signed or unsigned.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list