union //中断寄存器 { uint8 Register[2]; struct { uint8 control_out_port :1; uint8 control_in_port :1; uint8 port_out_1 :1; uint8 port_in_1 :1; uint8 main_out_port :1; uint8 main_in_port :1; uint8 bus_reset :1; uint8 suspend_change :1; uint8 DMA_EOT :1; uint8 not_use :7; }Interrupt; }Interrupt_Register;
为什么数组赋值后,就把数组中的每一位分配给结构中的每个变量了?没见过这种格式,是固定的吗? 比如 我让 Interrupt_Register.Register[0]=0xff 这时候 Interrupt_Register.Interrupt.control_out_port=1; Interrupt_Register.Interrupt.control_in_port=1; Interrupt_Register.Interrupt.port_out_1=1; Interrupt_Register.Interrupt.port_in_1=1; Interrupt_Register.Interrupt.main_out_port=1; Interrupt_Register.Interrupt.main_in_port=1; Interrupt_Register.Interrupt.bus_reset=1; Interrupt_Register.Interrupt.suspend_change=1 这些变量就都等于数组中的每一位了,是怎么传递过去的?还是是一种固定的赋值方式?
|