C Tutorial Code generated by bit fields
The C Language
C History
BCPL
Euclid’s Algorithm in C
Euclid on the PDP-11
Pieces of C
C Types
Declarators
Struct bit-fields
Code generated by bit fields

C Unions
Layout of Records and Unions
C Storage Classes
malloc() and free()
Dynamic Storage Allocation
Simple Dynamic Storage Allocation
malloc() and free() variants
Fragmentation
Fragmentation and Handles
Automatic Garbage Collection
Arrays
Lazy Logical Operators
The Switch Statement
setjmp/longjmp: Sloppy exceptions
Nondeterminism in C

 

 

HOME
 


 

struct {

 

 

Text Box:  
unsigned
int
a
:
5;
movzbl
 
unsigned
int
b
:
2;
andl
 
unsigned
int
c
:
3;
movl
 
}
flags;
 
 
 
 
 
 

 

 

  

void foo(int c) {

unsigned int b1 =flags.b;

flags.c = c;

}


 

 

# unsigned int b1 = flags.b

movb    flags, %al shrb 5, %al

%al, %eax

3, %eax

%eax, -4(%ebp) 

 

# flags.c = c;

movl    flags, %eax movl   8(%ebp), %edx andl    7, %edx

sall    7, %edx andl -897, %eax orl        %edx, %eax

movl  %eax, flags

 

Contact for more learning: webmaster@freehost7com