Thread: Splitting up int16_t to two int8_t

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    536
    Quote Originally Posted by Exile
    Does taht same problem exist for the solutions that use bit shifts? The shifts would work, but the results of the shift are switched.
    That was my point: Bit shifts (or arithmetic with '/' and '%' operators) allow you to extract the bytes whatever order you require. (Not endian-dependent.)

    The shift and arithmetic operators work on numbers in registers. Upper bits are upper bits; lower bits are lower bits.

    When the individual bytes get stored in memory, the byte order is dependent on the endianness of the machine. This shows up with different results for bid-endian systems and little-endian systems using the union.

    Regards,

    Dave
    Last edited by Dave Evans; 01-26-2005 at 03:51 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. winsock splitting msg
    By abraham2119 in forum Networking/Device Communication
    Replies: 10
    Last Post: 07-05-2009, 04:24 AM
  2. String splitting algorithm help
    By (TNT) in forum C++ Programming
    Replies: 7
    Last Post: 05-12-2007, 11:28 AM
  3. Problem splitting program into different files
    By kzar in forum C Programming
    Replies: 8
    Last Post: 09-19-2005, 06:03 AM
  4. Splitting the Window
    By cweb255 in forum Windows Programming
    Replies: 4
    Last Post: 05-30-2005, 06:19 AM
  5. Splitting a dialog up into multiple classes
    By Just in forum Windows Programming
    Replies: 1
    Last Post: 05-29-2005, 11:11 PM