Changeset 2048 for trunk/src/emx/include/386/builtin.h
- Timestamp:
- Jun 19, 2005, 6:10:41 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/386/builtin.h
-
Property cvs2svn:cvs-rev
changed from
1.11
to1.12
r2047 r2048 148 148 } 149 149 150 151 150 /** 152 151 * Atomically increments a 32-bit unsigned value. … … 164 163 * Atomically increments a 32-bit unsigned value. 165 164 * 165 * @returns The new value. 166 166 * @param pu32 Pointer to the value to increment. 167 167 */ 168 static __inline__ void __atomic_increment_u32(uint32_t __volatile__ *pu32) 169 { 170 __asm__ __volatile__("lock; incl %0" 171 : "=m" (*pu32) 172 : "m" (*pu32)); 168 static __inline__ uint32_t __atomic_increment_u32(uint32_t __volatile__ *pu32) 169 { 170 uint32_t u32; 171 __asm__ __volatile__("lock; xadd %0, %1\n\t" 172 "incl %0\n\t" 173 : "=r" (u32), 174 "=m" (*pu32) 175 : "0" (1) 176 : "memory"); 177 return u32; 178 } 179 180 /** 181 * Atomically increments a 32-bit signed value. 182 * 183 * @returns The new value. 184 * @param pi32 Pointer to the value to increment. 185 */ 186 static __inline__ uint32_t __atomic_increment_s32(int32_t __volatile__ *pi32) 187 { 188 int32_t i32; 189 __asm__ __volatile__("lock; xadd %0, %1\n\t" 190 "incl %0\n\t" 191 : "=r" (i32), 192 "=m" (*pi32) 193 : "0" (1) 194 : "memory"); 195 return i32; 173 196 } 174 197 … … 200 223 * Atomically decrements a 32-bit unsigned value. 201 224 * 202 * @param pu Pointer to the value to decrement. 203 */ 204 static __inline__ void __atomic_decrement_u32(__volatile__ uint32_t *pu32) 205 { 206 __asm__ __volatile__("lock; decl %0" 207 : "=m" (*pu32) 208 : "m" (*pu32)); 225 * @returns The new value. 226 * @param pu32 Pointer to the value to decrement. 227 */ 228 static __inline__ uint32_t __atomic_decrement_u32(__volatile__ uint32_t *pu32) 229 { 230 uint32_t u32; 231 __asm__ __volatile__("lock; xadd %0, %1\n\t" 232 "decl %0\n\t" 233 : "=r" (u32), 234 "=m" (*pu32) 235 : "0" (-1) 236 : "memory"); 237 return u32; 238 } 239 240 /** 241 * Atomically decrements a 32-bit signed value. 242 * 243 * @returns The new value. 244 * @param pi32 Pointer to the value to decrement. 245 */ 246 static __inline__ uint32_t __atomic_decrement_s32(__volatile__ int32_t *pi32) 247 { 248 int32_t i32; 249 __asm__ __volatile__("lock; xadd %0, %1\n\t" 250 "decl %0\n\t" 251 : "=r" (i32), 252 "=m" (*pi32) 253 : "0" (-1) 254 : "memory"); 255 return i32; 209 256 } 210 257 … … 212 259 * Atomically decrements a 16-bit unsigned value. 213 260 * 261 * @returns The new value. 214 262 * @param pu16 Pointer to the value to decrement. 215 263 */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.