include/SDL_atomic.h
changeset 3181 030899df1af5
parent 3180 77d6336711fc
child 3186 51750b7a966f
     1.1 --- a/include/SDL_atomic.h	Tue Jun 09 17:33:44 2009 +0000
     1.2 +++ b/include/SDL_atomic.h	Tue Jun 09 19:39:23 2009 +0000
     1.3 @@ -77,7 +77,7 @@
     1.4                         : "r" (newvalue),                     
     1.5                           "m" (*atomic),                    
     1.6                           "0" (oldvalue));
     1.7 -  return (rv == oldvalue);                                          
     1.8 +  return (SDL_bool)(rv == oldvalue);                                          
     1.9  }
    1.10  
    1.11  static __inline__ SDL_bool
    1.12 @@ -95,7 +95,7 @@
    1.13                         : "r" (newvalue),
    1.14                           "m" (*atomic),
    1.15                           "0" (oldvalue));
    1.16 -  return (rv == oldvalue);
    1.17 +  return (SDL_bool)(rv == oldvalue);
    1.18  }
    1.19  #elif defined(__GNUC__) && defined(__alpha__)
    1.20  # define ATOMIC_MEMORY_BARRIER (__asm__ __volatile__ ("mb" : : : "memory"))
    1.21 @@ -141,7 +141,7 @@
    1.22                           "Ir" (oldvalue),
    1.23                           "Ir" (newvalue)
    1.24                         : "memory");
    1.25 -  return (rv != 0);
    1.26 +  return (SDL_bool)(rv != 0);
    1.27  }
    1.28  # elif (SIZEOF_VOIDP == 8)
    1.29  static __inline__ SDL_bool
    1.30 @@ -164,7 +164,7 @@
    1.31                           "Ir" (oldvalue),
    1.32                           "Ir" (newvalue)
    1.33                         : "memory");
    1.34 -  return (rv != 0);
    1.35 +  return (SDL_bool)(rv != 0);
    1.36  }
    1.37  # else
    1.38  #  error "Your system has an unsupported pointer size"  
    1.39 @@ -195,7 +195,7 @@
    1.40                           "m" (*atomic),
    1.41                           "r" (atomic),
    1.42                           "0" (newvalue));
    1.43 -  return (rv == oldvalue);
    1.44 +  return (SDL_bool)(rv == oldvalue);
    1.45  }
    1.46  # elif (SIZEOF_VOIDP == 8)
    1.47  static __inline__ SDL_bool
    1.48 @@ -210,7 +210,7 @@
    1.49                           "m" (*a),
    1.50                           "r" (a),
    1.51                           "0" (newvalue));
    1.52 -  return (rv == oldvalue);
    1.53 +  return (SDL_bool)(rv == oldvalue);
    1.54  }
    1.55  # else
    1.56  #  error "Your system has an unsupported pointer size"
    1.57 @@ -273,7 +273,7 @@
    1.58                           "r"                              
    1.59                         : "cr0",                           
    1.60                           "memory");                         
    1.61 -  return (rv == 0);                                              
    1.62 +  return (SDL_bool)(rv == 0);                                              
    1.63  }
    1.64  
    1.65  static __inline__ SDL_bool
    1.66 @@ -293,7 +293,7 @@
    1.67                           "r" (newvalue)
    1.68                         : "cr0",
    1.69                         "memory");
    1.70 -  return (rv == 0);
    1.71 +  return (SDL_bool)(rv == 0);
    1.72  }
    1.73  # elif (SIZEOF_VOIDP == 8)
    1.74  static __inline__ SDL_bool
    1.75 @@ -314,7 +314,7 @@
    1.76                           "r"                              
    1.77                         : "cr0",                           
    1.78                           "memory");                         
    1.79 -  return (rv == 0);                                              
    1.80 +  return (SDL_bool)(rv == 0);                                              
    1.81  }
    1.82  
    1.83  static __inline__ SDL_bool
    1.84 @@ -334,7 +334,7 @@
    1.85                           "r" (newvalue)
    1.86                         : "cr0",
    1.87                         "memory");
    1.88 -  return (rv == 0);
    1.89 +  return (SDL_bool)(rv == 0);
    1.90  }
    1.91  # else
    1.92  #  error "Your system has an unsupported pointer size"
    1.93 @@ -463,7 +463,7 @@
    1.94                           "m" (*atomic),
    1.95                           "0" (rv)
    1.96                         : "memory");
    1.97 -  return rv;
    1.98 +  return (SDL_bool)rv;
    1.99  }
   1.100  
   1.101  static __inline__ void
   1.102 @@ -489,7 +489,7 @@
   1.103                         : "d" (newvalue),     
   1.104                           "m" (*atomic),    
   1.105                           "2" (oldvalue));    
   1.106 -    return rv;                                        
   1.107 +    return (SDL_bool)rv;                                        
   1.108  }
   1.109  
   1.110  static __inline__ SDL_bool
   1.111 @@ -505,7 +505,7 @@
   1.112                         : "d" (newvalue),     
   1.113                           "m" (*atomic),    
   1.114                           "2" (oldvalue));    
   1.115 -    return rv;                                        
   1.116 +    return (SDL_bool)rv;                                        
   1.117  }
   1.118  #elif defined(__GNUC__) && defined(__s390__)
   1.119  # define ATOMIC_INT_CMP_XCHG(atomic,oldvalue,newvalue)  \
   1.120 @@ -530,7 +530,7 @@
   1.121                         : "d" (newvalue),
   1.122                           "m" (*atomic)
   1.123                         : "cc");
   1.124 -  return (rv == oldvalue);
   1.125 +  return (SDL_bool)(rv == oldvalue);
   1.126  }
   1.127  # elif (SIZEOF_VOIDP == 8)
   1.128  static __inline__ SDL_bool
   1.129 @@ -544,7 +544,7 @@
   1.130                         : "d" ((long)(newvalue)),
   1.131                           "m" (*a)
   1.132                         : "cc");
   1.133 -  return (rv == oldvalue);
   1.134 +  return (SDL_bool)(rv == oldvalue);
   1.135  }
   1.136  # else
   1.137  #  error "Your system has an unsupported pointer size"
   1.138 @@ -567,9 +567,9 @@
   1.139  static __inline__ SDL_bool
   1.140  SDL_atmoic_int_cmp_xchg(volatile int* atomic, int oldvalue, int newvalue)
   1.141  {
   1.142 -  return ((SDL_bool)InterlockedCompareExchangePointer((PVOID*)atomic,
   1.143 -                                                      (PVOID)newvalue,
   1.144 -                                                      (PVOID)oldvalue) == oldvalue);
   1.145 +   return (SDL_bool)(InterlockedCompareExchangePointer((PVOID*)atomic,
   1.146 +                                                       (PVOID)newvalue,
   1.147 +                                                       (PVOID)oldvalue) == oldvalue);
   1.148  }
   1.149  
   1.150  
   1.151 @@ -624,7 +624,7 @@
   1.152  static __inline__ SDL_bool
   1.153  SDL_atomic_int_cmp_xchg(volatile int* atomic, int oldvalue, int newvalue)
   1.154  {
   1.155 -  return ATOMIC_INT_CMP_XCHG(atomic,oldvalue,newvalue);
   1.156 +  return (SDL_bool)ATOMIC_INT_CMP_XCHG(atomic,oldvalue,newvalue);
   1.157  }
   1.158  
   1.159  static __inline__ int