Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2020-09-04 Thread Darin Adler
> On Sep 3, 2020, at 11:14 PM, Fujii Hironori wrote: > > BTW, I don't like to idea adding a new rule, but keeping old style code. It > introduces divergence between the guideline and actual code. Do we really > need a new rule that one doesn’t necessary have to follow? I understand that you

Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2020-09-04 Thread Ryosuke Niwa
On Thu, Sep 3, 2020 at 11:15 PM Fujii Hironori wrote: > > On Fri, Sep 4, 2020 at 2:56 PM Ryosuke Niwa wrote: > >> On Thu, Sep 3, 2020 at 10:11 PM Fujii Hironori >> wrote: >> >>> >>> On Fri, Sep 4, 2020 at 1:31 PM Ryosuke Niwa wrote: >>> Consecutive bit fields must use the same type.

Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2020-09-04 Thread Fujii Hironori
On Fri, Sep 4, 2020 at 2:56 PM Ryosuke Niwa wrote: > On Thu, Sep 3, 2020 at 10:11 PM Fujii Hironori > wrote: > >> >> On Fri, Sep 4, 2020 at 1:31 PM Ryosuke Niwa wrote: >> >>> Consecutive bit fields must use the same type. >>> >> >> RenderLayer is mixing bool and unsigned in the consecutive bit

Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2020-09-03 Thread Ryosuke Niwa
On Thu, Sep 3, 2020 at 10:11 PM Fujii Hironori wrote: > > On Fri, Sep 4, 2020 at 1:31 PM Ryosuke Niwa wrote: > >> Consecutive bit fields must use the same type. >> > > RenderLayer is mixing bool and unsigned in the consecutive bit fields. > They should use only uint8_t, right? > >

Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2020-09-03 Thread Fujii Hironori
On Fri, Sep 4, 2020 at 1:31 PM Ryosuke Niwa wrote: > Consecutive bit fields must use the same type. > RenderLayer is mixing bool and unsigned in the consecutive bit fields. They should use only uint8_t, right?

Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2020-09-03 Thread Ryosuke Niwa
Hi all, I'm going to resurrect this thread from 2012 and suggest that we introduce a new coding style guide as it came up in https://webkit.org/b/216069. It looks like we added the rule to only use signed or unsigned as the underlying type of bit fields to our style checker in

[webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2012-03-29 Thread Ryosuke Niwa
Hi, Unlike gcc and clang, MSVC pads each consecutive member variables of the same type in bitfields. e.g. if you have: struct AB { unsigned m_1 : 31; bool m_2 : 1; } then *MSVC pads m_1 and allocates sizeof(unsigned) * 2 for AB* whereas gcc and clang only allocate sizeof(unsigned) * 1 for

Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2012-03-29 Thread Eric Seidel
For core classes like these we should COMPILE_ASSERT their size. We do this for many, but not all of these classes. On Thu, Mar 29, 2012 at 1:21 AM, Ryosuke Niwa rn...@webkit.org wrote: Hi, Unlike gcc and clang, MSVC pads each consecutive member variables of the same type in bitfields. e.g.

Re: [webkit-dev] PSA: Bit fields won't be packed on Windows if you mix types

2012-03-29 Thread Ryosuke Niwa
Yup. I'm enabling that for InlineBox on Windows in this bug: https://bugs.webkit.org/show_bug.cgi?id=82578 - Ryosuke On Thu, Mar 29, 2012 at 1:38 AM, Eric Seidel e...@webkit.org wrote: For core classes like these we should COMPILE_ASSERT their size. We do this for many, but not all of these