home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,038 of 33,346   
   Andy Champ to All   
   Re: compilers, endianness and padding   
   14 May 13 10:33:56   
   
   september.org> 67507c9c   
   From: no.way@nospam.invalid   
      
   On 14/05/2013 07:44, Tobias Müller wrote:   
   > Andy Champ  wrote:   
   >    > Incidentally, I think Intel have it right, and we humans have it   
   >    > wrong - least significant digit first means that you can read the   
   >    > number in one pass.   
   >   
   > But inside one byte, the bits are again ordered the other way round.   
   > I would agree with you if the bits were ordered in the same way, but a   
   > different order for bits and bytes is just awkward.   
   >   
   Are they? How do you know?   
      
   I always regard memory as a grid. The address is vertical, and the bit   
   position is horizontal.   
      
      
   >    > 1234 should be one and twenty and three hundred and four thousand.   
   >   
   > Yes, but with the usual little endian representation it's 2143.  (Not   
   > really but similar)   
   >   
   That's an artefact of humans using decimal, and computers using bytes -   
   you're treating it as a BCD number.   
      
   1234 read least-significant first is 0x4d2. In LSB-first memory that's   
   one byte of D2, and another of 04.   
      
   In memory it's   
   11010010   
   00000100   
      
   (or possibly   
   01001011   
   00100000)   
      
   Andy   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca