[vlc-commits] vlc_atomic: set the atomic types to be at least 32 bits wide with MSVC.

Felix Abecassis git at videolan.org
Fri Jan 3 12:51:02 CET 2014


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Fri Jan  3 12:46:04 2014 +0100| [66572ed7eace0d0ad17410f252f51f38726f3e8e] | committer: Jean-Baptiste Kempf

vlc_atomic: set the atomic types to be at least 32 bits wide with MSVC.

This change is required since some atomic operations of the
Interlocked API are only available for desktop apps.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 include/vlc_atomic.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/vlc_atomic.h b/include/vlc_atomic.h
index 037c639..688f6c5 100644
--- a/include/vlc_atomic.h
+++ b/include/vlc_atomic.h
@@ -57,6 +57,18 @@
  * unsigned equivalents, i.e. 4-bytes and 8-bytes types, although GCC also
  * supports 1 and 2-bytes types. Some non-x86 architectures do not support
  * 8-byte atomic types (or not efficiently). */
+#  if defined (_MSC_VER)
+/* Some atomic operations of the Interlocked API are only
+   available for desktop apps. Thus we define the atomic types to
+   be at least 32 bits wide. */
+typedef      int_least32_t atomic_flag;
+typedef      int_least32_t atomic_bool;
+typedef      int_least32_t atomic_char;
+typedef      int_least32_t atomic_schar;
+typedef     uint_least32_t atomic_uchar;
+typedef      int_least32_t atomic_short;
+typedef     uint_least32_t atomic_ushort;
+#  else
 typedef          bool      atomic_flag;
 typedef          bool      atomic_bool;
 typedef          char      atomic_char;
@@ -64,6 +76,7 @@ typedef   signed char      atomic_schar;
 typedef unsigned char      atomic_uchar;
 typedef          short     atomic_short;
 typedef unsigned short     atomic_ushort;
+#  endif
 typedef          int       atomic_int;
 typedef unsigned int       atomic_uint;
 typedef          long      atomic_long;



More information about the vlc-commits mailing list