Diff for /qemu/bswap.h between versions 1.1.1.3 and 1.1.1.6

version 1.1.1.3, 2018/04/24 16:50:52 version 1.1.1.6, 2018/04/24 18:24:25
Line 5 Line 5
   
 #include <inttypes.h>  #include <inttypes.h>
   
 #ifdef HAVE_MACHINE_BSWAP_H  #ifdef CONFIG_MACHINE_BSWAP_H
 #include <sys/endian.h>  #include <sys/endian.h>
 #include <sys/types.h>  #include <sys/types.h>
 #include <machine/bswap.h>  #include <machine/bswap.h>
 #else  #else
   
 #ifdef HAVE_BYTESWAP_H  #ifdef CONFIG_BYTESWAP_H
 #include <byteswap.h>  #include <byteswap.h>
 #else  #else
   
Line 47 Line 47
                 (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \                  (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
 })  })
   
 #endif /* !HAVE_BYTESWAP_H */  #endif /* !CONFIG_BYTESWAP_H */
   
 static inline uint16_t bswap16(uint16_t x)  static inline uint16_t bswap16(uint16_t x)
 {  {
Line 64  static inline uint64_t bswap64(uint64_t  Line 64  static inline uint64_t bswap64(uint64_t 
     return bswap_64(x);      return bswap_64(x);
 }  }
   
 #endif /* ! HAVE_MACHINE_BSWAP_H */  #endif /* ! CONFIG_MACHINE_BSWAP_H */
   
 static inline void bswap16s(uint16_t *s)  static inline void bswap16s(uint16_t *s)
 {  {
Line 81  static inline void bswap64s(uint64_t *s) Line 81  static inline void bswap64s(uint64_t *s)
     *s = bswap64(*s);      *s = bswap64(*s);
 }  }
   
 #if defined(WORDS_BIGENDIAN)  #if defined(HOST_WORDS_BIGENDIAN)
 #define be_bswap(v, size) (v)  #define be_bswap(v, size) (v)
 #define le_bswap(v, size) bswap ## size(v)  #define le_bswap(v, size) bswap ## size(v)
 #define be_bswaps(v, size)  #define be_bswaps(v, size)
Line 151  static inline void cpu_to_le16wu(uint16_ Line 151  static inline void cpu_to_le16wu(uint16_
 {  {
     uint8_t *p1 = (uint8_t *)p;      uint8_t *p1 = (uint8_t *)p;
   
     p1[0] = v;      p1[0] = v & 0xff;
     p1[1] = v >> 8;      p1[1] = v >> 8;
 }  }
   
Line 159  static inline void cpu_to_le32wu(uint32_ Line 159  static inline void cpu_to_le32wu(uint32_
 {  {
     uint8_t *p1 = (uint8_t *)p;      uint8_t *p1 = (uint8_t *)p;
   
     p1[0] = v;      p1[0] = v & 0xff;
     p1[1] = v >> 8;      p1[1] = v >> 8;
     p1[2] = v >> 16;      p1[2] = v >> 16;
     p1[3] = v >> 24;      p1[3] = v >> 24;
Line 188  static inline void cpu_to_be16wu(uint16_ Line 188  static inline void cpu_to_be16wu(uint16_
     uint8_t *p1 = (uint8_t *)p;      uint8_t *p1 = (uint8_t *)p;
   
     p1[0] = v >> 8;      p1[0] = v >> 8;
     p1[1] = v;      p1[1] = v & 0xff;
 }  }
   
 static inline void cpu_to_be32wu(uint32_t *p, uint32_t v)  static inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
Line 198  static inline void cpu_to_be32wu(uint32_ Line 198  static inline void cpu_to_be32wu(uint32_
     p1[0] = v >> 24;      p1[0] = v >> 24;
     p1[1] = v >> 16;      p1[1] = v >> 16;
     p1[2] = v >> 8;      p1[2] = v >> 8;
     p1[3] = v;      p1[3] = v & 0xff;
 }  }
   
 #endif  #endif
   
 #ifdef WORDS_BIGENDIAN  #ifdef HOST_WORDS_BIGENDIAN
 #define cpu_to_32wu cpu_to_be32wu  #define cpu_to_32wu cpu_to_be32wu
   #define leul_to_cpu(v) glue(glue(le,HOST_LONG_BITS),_to_cpu)(v)
 #else  #else
 #define cpu_to_32wu cpu_to_le32wu  #define cpu_to_32wu cpu_to_le32wu
   #define leul_to_cpu(v) (v)
 #endif  #endif
   
 #undef le_bswap  #undef le_bswap
Line 214  static inline void cpu_to_be32wu(uint32_ Line 216  static inline void cpu_to_be32wu(uint32_
 #undef le_bswaps  #undef le_bswaps
 #undef be_bswaps  #undef be_bswaps
   
   /* len must be one of 1, 2, 4 */
   static inline uint32_t qemu_bswap_len(uint32_t value, int len)
   {
       return bswap32(value) >> (32 - 8 * len);
   }
   
 #endif /* BSWAP_H */  #endif /* BSWAP_H */

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.6


unix.superglobalmegacorp.com