[Mesa-dev] [PATCH 08/19] i965/fs: Use a bitfield for fs_inst's bool fields.
Matt Turner
mattst88 at gmail.com
Fri Feb 21 13:42:45 PST 2014
On Fri, Feb 21, 2014 at 1:40 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Please just do:
>
> unsigned eot:1;
For
#include <stdint.h>
struct a {
unsigned a:1;
unsigned b:1;
unsigned c:1;
};
struct b {
uint8_t a:1;
uint8_t b:1;
uint8_t c:1;
};
void f(struct a a, struct b b) {}
pahole says:
struct a {
unsigned int a:1; /* 0:31 4 */
unsigned int b:1; /* 0:30 4 */
unsigned int c:1; /* 0:29 4 */
/* size: 4, cachelines: 1, members: 3 */
/* bit_padding: 29 bits */
/* last cacheline: 4 bytes */
};
struct b {
uint8_t a:1; /* 0: 7 1 */
uint8_t b:1; /* 0: 6 1 */
uint8_t c:1; /* 0: 5 1 */
/* size: 1, cachelines: 1, members: 3 */
/* bit_padding: 5 bits */
/* last cacheline: 1 bytes */
};
I initially used unsigned, but I noticed this.
More information about the mesa-dev
mailing list