[vlc-commits] fix build / c++ parity usage

Francois Cartegnie git at videolan.org
Tue Feb 13 10:59:20 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb 13 10:00:06 2018 +0100| [ccc3b13f181ae573c6539e0a8e8806742423fe0e] | committer: Francois Cartegnie

fix build / c++ parity usage

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ccc3b13f181ae573c6539e0a8e8806742423fe0e
---

 include/vlc_common.h              | 16 ++++++++++++++++
 modules/video_output/decklink.cpp |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index c347b9ac0c..27c19a7493 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -671,6 +671,22 @@ VLC_USED static inline int popcount(unsigned long long x)
 {
     return __builtin_popcountll(x);
 }
+
+VLC_USED static inline int parity(unsigned x)
+{
+    return __builtin_parity(x);
+}
+
+VLC_USED static inline int parity(unsigned long x)
+{
+    return __builtin_parityl(x);
+}
+
+VLC_USED static inline int parity(unsigned long long x)
+{
+    return __builtin_parityll(x);
+}
+
 # endif
 #else /* __GNUC__ */
 # ifndef __cplusplus
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index 1e50461087..47223f081f 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -865,7 +865,7 @@ static void send_AFD(uint8_t afdcode, uint8_t ar, uint8_t *buf)
 
     /* parity bit */
     for (size_t i = 3; i < len - 1; i++)
-        afd[i] |= parity(afd[i]) ? 0x100 : 0x200;
+        afd[i] |= parity((unsigned)afd[i]) ? 0x100 : 0x200;
 
     /* vanc checksum */
     uint16_t vanc_sum = 0;



More information about the vlc-commits mailing list