<html><head></head><body>Hi,<br><br>There is some rationale for uintptr: if you have at least one pointer per ref, you can't have more than UINTPTR_MAX (divided by sizeof (void *)) refs.<br><br>With uintmax, I don't see it. Also uintmax might not be supported as atomic if it's 128-bits.<br><br><div class="gmail_quote">Le 24 février 2020 10:52:40 GMT+02:00, Romain Vimont <rom1v@videolabs.io> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">LGTM<br><br>But maybe uintmax_t is more appropriate than uintptr_t (semantically).<br><br>On 2/24/20 9:33 AM, quentin.chateau@deepskycorp.com wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">From: Quentin Chateau <quentin.chateau@deepskycorp.com><hr>  include/vlc_atomic.h | 6 +++---<br>  1 file changed, 3 insertions(+), 3 deletions(-)<br><br>diff --git a/include/vlc_atomic.h b/include/vlc_atomic.h<br>index e2d4fe5360..625738849a 100644<br>--- a/include/vlc_atomic.h<br>+++ b/include/vlc_atomic.h<br>@@ -60,7 +60,7 @@ static inline void vlc_atomic_store_float(vlc_atomic_float *atom, float f)<br>  }<br>  <br>  typedef struct vlc_atomic_rc_t {<br>-    atomic_uint refs;<br>+    atomic_uintptr_t refs;<br>  } vlc_atomic_rc_t;<br>  <br>  /** Init the RC to 1 */<br>@@ -72,7 +72,7 @@ static inline void vlc_atomic_rc_init(vlc_atomic_rc_t *rc)<br>  /** Increment the RC */<br>  static inline void vlc_atomic_rc_inc(vlc_atomic_rc_t *rc)<br>  {<br>-    unsigned prev = atomic_fetch_add_explicit(&rc->refs, 1, memory_order_relaxed);<br>+    uintptr_t prev = atomic_fetch_add_explicit(&rc->refs, 1, memory_order_relaxed);<br>      vlc_assert(prev);<br>      VLC_UNUSED(prev);<br>  }<br>@@ -80,7 +80,7 @@ static inline void vlc_atomic_rc_inc(vlc_atomic_rc_t *rc)<br>  /** Decrement the RC and return true if it reaches 0 */<br>  static inline bool vlc_atomic_rc_dec(vlc_atomic_rc_t *rc)<br>  {<br>-    unsigned prev = atomic_fetch_sub_explicit(&rc->refs, 1, memory_order_acq_rel);<br>+    uintptr_t prev = atomic_fetch_sub_explicit(&rc->refs, 1, memory_order_acq_rel);<br>      vlc_assert(prev);<br>      return prev == 1;<br>  }<br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>