Endian confuse me. I am studing again. > You are saying that > struct { > unsigned char r:5; > }; > allocates the TOP (MSB) bits in big endian? Yes, in case 11110000(b)=0xF0 , r is 0x1e. please refer to http://www.linuxjournal.com/node/6788/print. > I don't think so. > I agree it allocates the top BYTE in big endian, but the > bits in the byte are still allocated from 0 up, not 7 down. > This will still allocate the LOWER 5 bits in either endian,I think. > So the issue is that bytes are re-ordered, but NOT bits, in little vs big > endian. typedef union { struct { unsigned char r:5 } r; unsigned char v; } BF BF c; c.v = 0xF0; // 11110000 then, in a big endian c.f.r = 0x1e in a little endian c.f.r = 0x10 It is tested on QEMU with arm big-endian. ( $ qemu-armeb a.out ) Regards, Sung Joo
- [nanogui] Re: [FIX] add alpha channel into GdDrawImage sof... Greg Haerr
- [nanogui] RE: Re: [FIX] add alpha channel into GdDr... Sung Joo , Byun
- [nanogui] Re: Re: [FIX] add alpha channel into Gd... Greg Haerr
- RE: [nanogui] Re: Re: [FIX] add alph a chann... Sung Joo , Byun
- Re: [nanogui] Re: Re: [FIX] add alpha cha... Greg Haerr
- RE: Re: [nanogui] Re: Re: [FIX] add ... Sung Joo , Byun
- Re: Re: [nanogui] Re: Re: [FIX] ... Greg Haerr
- Re: Re: [nanogui] Re: Re: [FIX] ... Greg Haerr
- Re: Re: [nanogui] Re: Re: [F... Greg Haerr
- RE: Re: Re: [nanogui] Re: Re... Sung Joo , Byun
- Re: Re: Re: [nanogui] Re: Re... Greg Haerr
- RE: [nanogui] Re: Re: [FIX] add alph a chann... Sung Joo , Byun
- Re: [nanogui] Re: Re: [FIX] add alpha cha... Greg Haerr
- RE: Re: [nanogui] Re: Re: [FIX] add ... Sung Joo , Byun
- Re: Re: [nanogui] Re: Re: [FIX] ... Greg Haerr