[vlc-commits] Remove fixed-size clzXX()

Rémi Denis-Courmont git at videolan.org
Sun Feb 11 12:49:21 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 11 11:54:37 2018 +0200| [00c2ff8d87ebe0000bc926fee42cfc72ee821a0d] | committer: Rémi Denis-Courmont

Remove fixed-size clzXX()

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

 include/vlc_common.h       | 4 ----
 modules/audio_output/oss.c | 4 ++--
 src/text/unicode.c         | 2 +-
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 78fdfadfbb..effb8fbcdb 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -485,10 +485,6 @@ VLC_USED static inline int clzbits(unsigned long long x, int maxbits)
 # endif
 #endif
 
-#define clz8(x)  clz((uint8_t)(x))
-#define clz16(x) clz((uint16_t)(x))
-#define clz32(x) clz((uint32_t)(x))
-
 /** Count trailing zeroes */
 VLC_USED
 static inline unsigned (ctz)(unsigned x)
diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 52a648fc86..5944f1444b 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -219,7 +219,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
     aout_FormatPrepare (fmt);
 
     /* Select timing */
-    unsigned bytes;
+    uint32_t bytes;
     if (spdif)
         bytes = AOUT_SPDIF_SIZE;
     else
@@ -229,7 +229,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
         bytes = 16;
 
     int frag = (AOUT_MAX_ADVANCE_TIME / AOUT_MIN_PREPARE_TIME) << 16
-             | (32 - clz32(bytes - 1));
+             | (32 - clz(bytes - 1));
     if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &frag) < 0)
         msg_Err (aout, "cannot set 0x%08x fragment: %s", frag,
                  vlc_strerror_c(errno));
diff --git a/src/text/unicode.c b/src/text/unicode.c
index 88eb6d2ea8..54f05480dd 100644
--- a/src/text/unicode.c
+++ b/src/text/unicode.c
@@ -121,7 +121,7 @@ size_t vlc_towc (const char *str, uint32_t *restrict pwc)
     if (unlikely(c > 0xF4))
         return -1;
 
-    int charlen = clz8 (c ^ 0xFF);
+    int charlen = clz((unsigned char)(c ^ 0xFF));
     switch (charlen)
     {
         case 0: // 7-bit ASCII character -> short cut



More information about the vlc-commits mailing list