]> git.sesse.net Git - vlc/blobdiff - include/vlc_common.h
Fix serbian.nsh
[vlc] / include / vlc_common.h
index 9e49c35fb09638d7fce8a5140e6b459e73d6d455..6cf89a7bacb02ae40109dba800c1a3a9bd02fd8e 100644 (file)
@@ -657,7 +657,7 @@ static inline uint64_t bswap64 (uint64_t x)
 {
 #if VLC_GCC_VERSION(4,3)
     return __builtin_bswap64 (x);
-#else
+#elif !defined (__cplusplus)
     return ((x & 0x00000000000000FF) << 56)
          | ((x & 0x000000000000FF00) << 40)
          | ((x & 0x0000000000FF0000) << 24)
@@ -666,6 +666,15 @@ static inline uint64_t bswap64 (uint64_t x)
          | ((x & 0x0000FF0000000000) >> 24)
          | ((x & 0x00FF000000000000) >> 40)
          | ((x & 0xFF00000000000000) >> 56);
+#else
+    return ((x & 0x00000000000000FFLLU) << 56)
+         | ((x & 0x000000000000FF00LLU) << 40)
+         | ((x & 0x0000000000FF0000LLU) << 24)
+         | ((x & 0x00000000FF000000LLU) <<  8)
+         | ((x & 0x000000FF00000000LLU) >>  8)
+         | ((x & 0x0000FF0000000000LLU) >> 24)
+         | ((x & 0x00FF000000000000LLU) >> 40)
+         | ((x & 0xFF00000000000000LLU) >> 56);
 #endif
 }
 
@@ -685,7 +694,7 @@ VLC_API char const * vlc_error( int ) VLC_USED;
 #ifdef WORDS_BIGENDIAN
 # define hton16(i) ((uint16_t)(i))
 # define hton32(i) ((uint32_t)(i))
-# define hton64(i) ((uint32_t)(i))
+# define hton64(i) ((uint64_t)(i))
 #else
 # define hton16(i) bswap16(i)
 # define hton32(i) bswap32(i)
@@ -769,28 +778,28 @@ static inline uint64_t GetQWLE (const void *p)
 }
 
 /** Writes 16 bits in network byte order */
-static inline void SetWLE (void *p, uint16_t w)
+static inline void SetWBE (void *p, uint16_t w)
 {
     w = hton16 (w);
     memcpy (p, &w, sizeof (w));
 }
 
 /** Writes 32 bits in network byte order */
-static inline void SetDWLE (void *p, uint32_t dw)
+static inline void SetDWBE (void *p, uint32_t dw)
 {
     dw = hton32 (dw);
     memcpy (p, &dw, sizeof (dw));
 }
 
 /** Writes 64 bits in network byte order */
-static inline void SetQWLE (void *p, uint64_t qw)
+static inline void SetQWBE (void *p, uint64_t qw)
 {
     qw = hton64 (qw);
     memcpy (p, &qw, sizeof (qw));
 }
 
 /** Writes 16 bits in little endian order */
-static inline void SetWBE (void *p, uint16_t w)
+static inline void SetWLE (void *p, uint16_t w)
 {
 #ifdef WORDS_BIGENDIAN
     w = bswap16 (w);
@@ -799,7 +808,7 @@ static inline void SetWBE (void *p, uint16_t w)
 }
 
 /** Writes 32 bits in little endian order */
-static inline void SetDWBE (void *p, uint32_t dw)
+static inline void SetDWLE (void *p, uint32_t dw)
 {
 #ifdef WORDS_BIGENDIAN
     dw = bswap32 (dw);
@@ -808,10 +817,10 @@ static inline void SetDWBE (void *p, uint32_t dw)
 }
 
 /** Writes 64 bits in little endian order */
-static inline void SetQWBE (void *p, uint64_t qw)
+static inline void SetQWLE (void *p, uint64_t qw)
 {
 #ifdef WORDS_BIGENDIAN
-    qw = bswap32 (qw);
+    qw = bswap64 (qw);
 #endif
     memcpy (p, &qw, sizeof (qw));
 }