Mercurial > sdl-ios-xcode
comparison src/atomic/dummy/SDL_atomic.c @ 3216:48a80f2a7ff2
volitile... duh, yeah the variable need to be labeled volitile
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Thu, 09 Jul 2009 21:31:27 +0000 |
parents | 759032c318d8 |
children | 72b542f34739 |
comparison
equal
deleted
inserted
replaced
3215:b425c3e2b796 | 3216:48a80f2a7ff2 |
---|---|
163 #endif | 163 #endif |
164 | 164 |
165 /* 8 bit atomic operations */ | 165 /* 8 bit atomic operations */ |
166 | 166 |
167 Uint8 | 167 Uint8 |
168 SDL_AtomicExchange8(Uint8 * ptr, Uint8 value) | 168 SDL_AtomicExchange8(volatile Uint8 * ptr, Uint8 value) |
169 { | 169 { |
170 #ifdef nativeExchange8 | 170 #ifdef nativeExchange8 |
171 return nativeExchange8(ptr, value); | 171 return nativeExchange8(ptr, value); |
172 #else | 172 #else |
173 Uint8 tmp = 0; | 173 Uint8 tmp = 0; |
180 return tmp; | 180 return tmp; |
181 #endif | 181 #endif |
182 } | 182 } |
183 | 183 |
184 SDL_bool | 184 SDL_bool |
185 SDL_AtomicCompareThenSet8(Uint8 * ptr, Uint8 oldvalue, Uint8 newvalue) | 185 SDL_AtomicCompareThenSet8(volatile Uint8 * ptr, Uint8 oldvalue, Uint8 newvalue) |
186 { | 186 { |
187 #ifdef nativeCompareThenSet8 | 187 #ifdef nativeCompareThenSet8 |
188 return (SDL_bool)nativeCompareThenSet8(ptr, oldvalue, newvalue); | 188 return (SDL_bool)nativeCompareThenSet8(ptr, oldvalue, newvalue); |
189 #else | 189 #else |
190 SDL_bool result = SDL_FALSE; | 190 SDL_bool result = SDL_FALSE; |
200 return result; | 200 return result; |
201 #endif | 201 #endif |
202 } | 202 } |
203 | 203 |
204 SDL_bool | 204 SDL_bool |
205 SDL_AtomicTestThenSet8(Uint8 * ptr) | 205 SDL_AtomicTestThenSet8(volatile Uint8 * ptr) |
206 { | 206 { |
207 #ifdef nativeTestThenSet8 | 207 #ifdef nativeTestThenSet8 |
208 return (SDL_bool)nativeTestThenSet8(ptr); | 208 return (SDL_bool)nativeTestThenSet8(ptr); |
209 #else | 209 #else |
210 SDL_bool result = SDL_FALSE; | 210 SDL_bool result = SDL_FALSE; |
220 return result; | 220 return result; |
221 #endif | 221 #endif |
222 } | 222 } |
223 | 223 |
224 void | 224 void |
225 SDL_AtomicClear8(Uint8 * ptr) | 225 SDL_AtomicClear8(volatile Uint8 * ptr) |
226 { | 226 { |
227 #ifdef nativeClear8 | 227 #ifdef nativeClear8 |
228 nativeClear8(ptr); | 228 nativeClear8(ptr); |
229 #else | 229 #else |
230 privateWaitLock(); | 230 privateWaitLock(); |
234 return; | 234 return; |
235 #endif | 235 #endif |
236 } | 236 } |
237 | 237 |
238 Uint8 | 238 Uint8 |
239 SDL_AtomicFetchThenIncrement8(Uint8 * ptr) | 239 SDL_AtomicFetchThenIncrement8(volatile Uint8 * ptr) |
240 { | 240 { |
241 #ifdef nativeFetchThenIncrement8 | 241 #ifdef nativeFetchThenIncrement8 |
242 return nativeFetchThenIncrement8(ptr); | 242 return nativeFetchThenIncrement8(ptr); |
243 #else | 243 #else |
244 Uint8 tmp = 0; | 244 Uint8 tmp = 0; |
251 return tmp; | 251 return tmp; |
252 #endif | 252 #endif |
253 } | 253 } |
254 | 254 |
255 Uint8 | 255 Uint8 |
256 SDL_AtomicFetchThenDecrement8(Uint8 * ptr) | 256 SDL_AtomicFetchThenDecrement8(volatile Uint8 * ptr) |
257 { | 257 { |
258 #ifdef nativeFetchThenDecrement8 | 258 #ifdef nativeFetchThenDecrement8 |
259 return nativeFetchThenDecrement8(ptr); | 259 return nativeFetchThenDecrement8(ptr); |
260 #else | 260 #else |
261 Uint8 tmp = 0; | 261 Uint8 tmp = 0; |
268 return tmp; | 268 return tmp; |
269 #endif | 269 #endif |
270 } | 270 } |
271 | 271 |
272 Uint8 | 272 Uint8 |
273 SDL_AtomicFetchThenAdd8(Uint8 * ptr, Uint8 value) | 273 SDL_AtomicFetchThenAdd8(volatile Uint8 * ptr, Uint8 value) |
274 { | 274 { |
275 #ifdef nativeFetchThenAdd8 | 275 #ifdef nativeFetchThenAdd8 |
276 return nativeFetchThenAdd8(ptr, value); | 276 return nativeFetchThenAdd8(ptr, value); |
277 #else | 277 #else |
278 Uint8 tmp = 0; | 278 Uint8 tmp = 0; |
285 return tmp; | 285 return tmp; |
286 #endif | 286 #endif |
287 } | 287 } |
288 | 288 |
289 Uint8 | 289 Uint8 |
290 SDL_AtomicFetchThenSubtract8(Uint8 * ptr, Uint8 value) | 290 SDL_AtomicFetchThenSubtract8(volatile Uint8 * ptr, Uint8 value) |
291 { | 291 { |
292 #ifdef nativeFetchThenSubtract8 | 292 #ifdef nativeFetchThenSubtract8 |
293 return nativeFetchThenSubtract8(ptr, value); | 293 return nativeFetchThenSubtract8(ptr, value); |
294 #else | 294 #else |
295 Uint8 tmp = 0; | 295 Uint8 tmp = 0; |
302 return tmp; | 302 return tmp; |
303 #endif | 303 #endif |
304 } | 304 } |
305 | 305 |
306 Uint8 | 306 Uint8 |
307 SDL_AtomicIncrementThenFetch8(Uint8 * ptr) | 307 SDL_AtomicIncrementThenFetch8(volatile Uint8 * ptr) |
308 { | 308 { |
309 #ifdef nativeIncrementThenFetch8 | 309 #ifdef nativeIncrementThenFetch8 |
310 return nativeIncrementThenFetch8(ptr); | 310 return nativeIncrementThenFetch8(ptr); |
311 #else | 311 #else |
312 Uint8 tmp = 0; | 312 Uint8 tmp = 0; |
319 return tmp; | 319 return tmp; |
320 #endif | 320 #endif |
321 } | 321 } |
322 | 322 |
323 Uint8 | 323 Uint8 |
324 SDL_AtomicDecrementThenFetch8(Uint8 * ptr) | 324 SDL_AtomicDecrementThenFetch8(volatile Uint8 * ptr) |
325 { | 325 { |
326 #ifdef nativeDecrementThenFetch8 | 326 #ifdef nativeDecrementThenFetch8 |
327 return nativeDecrementThenFetch8(ptr); | 327 return nativeDecrementThenFetch8(ptr); |
328 #else | 328 #else |
329 Uint8 tmp = 0; | 329 Uint8 tmp = 0; |
336 return tmp; | 336 return tmp; |
337 #endif | 337 #endif |
338 } | 338 } |
339 | 339 |
340 Uint8 | 340 Uint8 |
341 SDL_AtomicAddThenFetch8(Uint8 * ptr, Uint8 value) | 341 SDL_AtomicAddThenFetch8(volatile Uint8 * ptr, Uint8 value) |
342 { | 342 { |
343 #ifdef nativeAddThenFetch8 | 343 #ifdef nativeAddThenFetch8 |
344 return nativeAddThenFetch8(ptr, value); | 344 return nativeAddThenFetch8(ptr, value); |
345 #else | 345 #else |
346 Uint8 tmp = 0; | 346 Uint8 tmp = 0; |
353 return tmp; | 353 return tmp; |
354 #endif | 354 #endif |
355 } | 355 } |
356 | 356 |
357 Uint8 | 357 Uint8 |
358 SDL_AtomicSubtractThenFetch8(Uint8 * ptr, Uint8 value) | 358 SDL_AtomicSubtractThenFetch8(volatile Uint8 * ptr, Uint8 value) |
359 { | 359 { |
360 #ifdef nativeSubtractThenFetch8 | 360 #ifdef nativeSubtractThenFetch8 |
361 return nativeSubtractThenFetch8(ptr, value); | 361 return nativeSubtractThenFetch8(ptr, value); |
362 #else | 362 #else |
363 Uint8 tmp = 0; | 363 Uint8 tmp = 0; |
372 } | 372 } |
373 | 373 |
374 /* 16 bit atomic operations */ | 374 /* 16 bit atomic operations */ |
375 | 375 |
376 Uint16 | 376 Uint16 |
377 SDL_AtomicExchange16(Uint16 * ptr, Uint16 value) | 377 SDL_AtomicExchange16(volatile Uint16 * ptr, Uint16 value) |
378 { | 378 { |
379 #ifdef nativeExchange16 | 379 #ifdef nativeExchange16 |
380 return nativeExchange16(ptr, value); | 380 return nativeExchange16(ptr, value); |
381 #else | 381 #else |
382 Uint16 tmp = 0; | 382 Uint16 tmp = 0; |
389 return tmp; | 389 return tmp; |
390 #endif | 390 #endif |
391 } | 391 } |
392 | 392 |
393 SDL_bool | 393 SDL_bool |
394 SDL_AtomicCompareThenSet16(Uint16 * ptr, Uint16 oldvalue, Uint16 newvalue) | 394 SDL_AtomicCompareThenSet16(volatile Uint16 * ptr, Uint16 oldvalue, Uint16 newvalue) |
395 { | 395 { |
396 #ifdef nativeCompareThenSet16 | 396 #ifdef nativeCompareThenSet16 |
397 return (SDL_bool)nativeCompareThenSet16(ptr, oldvalue, newvalue); | 397 return (SDL_bool)nativeCompareThenSet16(ptr, oldvalue, newvalue); |
398 #else | 398 #else |
399 SDL_bool result = SDL_FALSE; | 399 SDL_bool result = SDL_FALSE; |
409 return result; | 409 return result; |
410 #endif | 410 #endif |
411 } | 411 } |
412 | 412 |
413 SDL_bool | 413 SDL_bool |
414 SDL_AtomicTestThenSet16(Uint16 * ptr) | 414 SDL_AtomicTestThenSet16(volatile Uint16 * ptr) |
415 { | 415 { |
416 #ifdef nativeTestThenSet16 | 416 #ifdef nativeTestThenSet16 |
417 return (SDL_bool)nativeTestThenSet16(ptr); | 417 return (SDL_bool)nativeTestThenSet16(ptr); |
418 #else | 418 #else |
419 SDL_bool result = SDL_FALSE; | 419 SDL_bool result = SDL_FALSE; |
429 return result; | 429 return result; |
430 #endif | 430 #endif |
431 } | 431 } |
432 | 432 |
433 void | 433 void |
434 SDL_AtomicClear16(Uint16 * ptr) | 434 SDL_AtomicClear16(volatile Uint16 * ptr) |
435 { | 435 { |
436 #ifdef nativeClear16 | 436 #ifdef nativeClear16 |
437 nativeClear16(ptr); | 437 nativeClear16(ptr); |
438 #else | 438 #else |
439 privateWaitLock(); | 439 privateWaitLock(); |
443 return; | 443 return; |
444 #endif | 444 #endif |
445 } | 445 } |
446 | 446 |
447 Uint16 | 447 Uint16 |
448 SDL_AtomicFetchThenIncrement16(Uint16 * ptr) | 448 SDL_AtomicFetchThenIncrement16(volatile Uint16 * ptr) |
449 { | 449 { |
450 #ifdef nativeFetchThenIncrement16 | 450 #ifdef nativeFetchThenIncrement16 |
451 return nativeFetchThenIncrement16(ptr); | 451 return nativeFetchThenIncrement16(ptr); |
452 #else | 452 #else |
453 Uint16 tmp = 0; | 453 Uint16 tmp = 0; |
460 return tmp; | 460 return tmp; |
461 #endif | 461 #endif |
462 } | 462 } |
463 | 463 |
464 Uint16 | 464 Uint16 |
465 SDL_AtomicFetchThenDecrement16(Uint16 * ptr) | 465 SDL_AtomicFetchThenDecrement16(volatile Uint16 * ptr) |
466 { | 466 { |
467 #ifdef nativeFetchThenDecrement16 | 467 #ifdef nativeFetchThenDecrement16 |
468 return nativeFetchThenDecrement16(ptr); | 468 return nativeFetchThenDecrement16(ptr); |
469 #else | 469 #else |
470 Uint16 tmp = 0; | 470 Uint16 tmp = 0; |
477 return tmp; | 477 return tmp; |
478 #endif | 478 #endif |
479 } | 479 } |
480 | 480 |
481 Uint16 | 481 Uint16 |
482 SDL_AtomicFetchThenAdd16(Uint16 * ptr, Uint16 value) | 482 SDL_AtomicFetchThenAdd16(volatile Uint16 * ptr, Uint16 value) |
483 { | 483 { |
484 #ifdef nativeFetchThenAdd16 | 484 #ifdef nativeFetchThenAdd16 |
485 return nativeFetchThenAdd16(ptr, value); | 485 return nativeFetchThenAdd16(ptr, value); |
486 #else | 486 #else |
487 Uint16 tmp = 0; | 487 Uint16 tmp = 0; |
494 return tmp; | 494 return tmp; |
495 #endif | 495 #endif |
496 } | 496 } |
497 | 497 |
498 Uint16 | 498 Uint16 |
499 SDL_AtomicFetchThenSubtract16(Uint16 * ptr, Uint16 value) | 499 SDL_AtomicFetchThenSubtract16(volatile Uint16 * ptr, Uint16 value) |
500 { | 500 { |
501 #ifdef nativeFetchThenSubtract16 | 501 #ifdef nativeFetchThenSubtract16 |
502 return nativeFetchThenSubtract16(ptr, value); | 502 return nativeFetchThenSubtract16(ptr, value); |
503 #else | 503 #else |
504 Uint16 tmp = 0; | 504 Uint16 tmp = 0; |
511 return tmp; | 511 return tmp; |
512 #endif | 512 #endif |
513 } | 513 } |
514 | 514 |
515 Uint16 | 515 Uint16 |
516 SDL_AtomicIncrementThenFetch16(Uint16 * ptr) | 516 SDL_AtomicIncrementThenFetch16(volatile Uint16 * ptr) |
517 { | 517 { |
518 #ifdef nativeIncrementThenFetch16 | 518 #ifdef nativeIncrementThenFetch16 |
519 return nativeIncrementThenFetch16(ptr); | 519 return nativeIncrementThenFetch16(ptr); |
520 #else | 520 #else |
521 Uint16 tmp = 0; | 521 Uint16 tmp = 0; |
528 return tmp; | 528 return tmp; |
529 #endif | 529 #endif |
530 } | 530 } |
531 | 531 |
532 Uint16 | 532 Uint16 |
533 SDL_AtomicDecrementThenFetch16(Uint16 * ptr) | 533 SDL_AtomicDecrementThenFetch16(volatile Uint16 * ptr) |
534 { | 534 { |
535 #ifdef nativeDecrementThenFetch16 | 535 #ifdef nativeDecrementThenFetch16 |
536 return nativeDecrementThenFetch16(ptr); | 536 return nativeDecrementThenFetch16(ptr); |
537 #else | 537 #else |
538 Uint16 tmp = 0; | 538 Uint16 tmp = 0; |
545 return tmp; | 545 return tmp; |
546 #endif | 546 #endif |
547 } | 547 } |
548 | 548 |
549 Uint16 | 549 Uint16 |
550 SDL_AtomicAddThenFetch16(Uint16 * ptr, Uint16 value) | 550 SDL_AtomicAddThenFetch16(volatile Uint16 * ptr, Uint16 value) |
551 { | 551 { |
552 #ifdef nativeAddThenFetch16 | 552 #ifdef nativeAddThenFetch16 |
553 return nativeAddThenFetch16(ptr, value); | 553 return nativeAddThenFetch16(ptr, value); |
554 #else | 554 #else |
555 Uint16 tmp = 0; | 555 Uint16 tmp = 0; |
562 return tmp; | 562 return tmp; |
563 #endif | 563 #endif |
564 } | 564 } |
565 | 565 |
566 Uint16 | 566 Uint16 |
567 SDL_AtomicSubtractThenFetch16(Uint16 * ptr, Uint16 value) | 567 SDL_AtomicSubtractThenFetch16(volatile Uint16 * ptr, Uint16 value) |
568 { | 568 { |
569 #ifdef nativeSubtractThenFetch16 | 569 #ifdef nativeSubtractThenFetch16 |
570 return nativeSubtractThenFetch16(ptr, value); | 570 return nativeSubtractThenFetch16(ptr, value); |
571 #else | 571 #else |
572 Uint16 tmp = 0; | 572 Uint16 tmp = 0; |
581 } | 581 } |
582 | 582 |
583 /* 32 bit atomic operations */ | 583 /* 32 bit atomic operations */ |
584 | 584 |
585 Uint32 | 585 Uint32 |
586 SDL_AtomicExchange32(Uint32 * ptr, Uint32 value) | 586 SDL_AtomicExchange32(volatile Uint32 * ptr, Uint32 value) |
587 { | 587 { |
588 #ifdef nativeExchange32 | 588 #ifdef nativeExchange32 |
589 return nativeExchange32(ptr, value); | 589 return nativeExchange32(ptr, value); |
590 #else | 590 #else |
591 Uint32 tmp = 0; | 591 Uint32 tmp = 0; |
598 return tmp; | 598 return tmp; |
599 #endif | 599 #endif |
600 } | 600 } |
601 | 601 |
602 SDL_bool | 602 SDL_bool |
603 SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue) | 603 SDL_AtomicCompareThenSet32(volatile Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue) |
604 { | 604 { |
605 #ifdef nativeCompareThenSet32 | 605 #ifdef nativeCompareThenSet32 |
606 return (SDL_bool)nativeCompareThenSet32(ptr, oldvalue, newvalue); | 606 return (SDL_bool)nativeCompareThenSet32(ptr, oldvalue, newvalue); |
607 #else | 607 #else |
608 SDL_bool result = SDL_FALSE; | 608 SDL_bool result = SDL_FALSE; |
618 return result; | 618 return result; |
619 #endif | 619 #endif |
620 } | 620 } |
621 | 621 |
622 SDL_bool | 622 SDL_bool |
623 SDL_AtomicTestThenSet32(Uint32 * ptr) | 623 SDL_AtomicTestThenSet32(volatile Uint32 * ptr) |
624 { | 624 { |
625 #ifdef nativeTestThenSet32 | 625 #ifdef nativeTestThenSet32 |
626 return (SDL_bool)nativeTestThenSet32(ptr); | 626 return (SDL_bool)nativeTestThenSet32(ptr); |
627 #else | 627 #else |
628 SDL_bool result = SDL_FALSE; | 628 SDL_bool result = SDL_FALSE; |
638 return result; | 638 return result; |
639 #endif | 639 #endif |
640 } | 640 } |
641 | 641 |
642 void | 642 void |
643 SDL_AtomicClear32(Uint32 * ptr) | 643 SDL_AtomicClear32(volatile Uint32 * ptr) |
644 { | 644 { |
645 #ifdef nativeClear32 | 645 #ifdef nativeClear32 |
646 nativeClear32(ptr); | 646 nativeClear32(ptr); |
647 #else | 647 #else |
648 privateWaitLock(); | 648 privateWaitLock(); |
652 return; | 652 return; |
653 #endif | 653 #endif |
654 } | 654 } |
655 | 655 |
656 Uint32 | 656 Uint32 |
657 SDL_AtomicFetchThenIncrement32(Uint32 * ptr) | 657 SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr) |
658 { | 658 { |
659 #ifdef nativeFetchThenIncrement32 | 659 #ifdef nativeFetchThenIncrement32 |
660 return nativeFetchThenIncrement32(ptr); | 660 return nativeFetchThenIncrement32(ptr); |
661 #else | 661 #else |
662 Uint32 tmp = 0; | 662 Uint32 tmp = 0; |
669 return tmp; | 669 return tmp; |
670 #endif | 670 #endif |
671 } | 671 } |
672 | 672 |
673 Uint32 | 673 Uint32 |
674 SDL_AtomicFetchThenDecrement32(Uint32 * ptr) | 674 SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr) |
675 { | 675 { |
676 #ifdef nativeFetchThenDecrement32 | 676 #ifdef nativeFetchThenDecrement32 |
677 return nativeFetchThenDecrement32(ptr); | 677 return nativeFetchThenDecrement32(ptr); |
678 #else | 678 #else |
679 Uint32 tmp = 0; | 679 Uint32 tmp = 0; |
686 return tmp; | 686 return tmp; |
687 #endif | 687 #endif |
688 } | 688 } |
689 | 689 |
690 Uint32 | 690 Uint32 |
691 SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value) | 691 SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value) |
692 { | 692 { |
693 #ifdef nativeFetchThenAdd32 | 693 #ifdef nativeFetchThenAdd32 |
694 return nativeFetchThenAdd32(ptr, value); | 694 return nativeFetchThenAdd32(ptr, value); |
695 #else | 695 #else |
696 Uint32 tmp = 0; | 696 Uint32 tmp = 0; |
703 return tmp; | 703 return tmp; |
704 #endif | 704 #endif |
705 } | 705 } |
706 | 706 |
707 Uint32 | 707 Uint32 |
708 SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value) | 708 SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value) |
709 { | 709 { |
710 #ifdef nativeFetchThenSubtract32 | 710 #ifdef nativeFetchThenSubtract32 |
711 return nativeFetchThenSubtract32(ptr, value); | 711 return nativeFetchThenSubtract32(ptr, value); |
712 #else | 712 #else |
713 Uint32 tmp = 0; | 713 Uint32 tmp = 0; |
720 return tmp; | 720 return tmp; |
721 #endif | 721 #endif |
722 } | 722 } |
723 | 723 |
724 Uint32 | 724 Uint32 |
725 SDL_AtomicIncrementThenFetch32(Uint32 * ptr) | 725 SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr) |
726 { | 726 { |
727 #ifdef nativeIncrementThenFetch32 | 727 #ifdef nativeIncrementThenFetch32 |
728 return nativeIncrementThenFetch32(ptr); | 728 return nativeIncrementThenFetch32(ptr); |
729 #else | 729 #else |
730 Uint32 tmp = 0; | 730 Uint32 tmp = 0; |
737 return tmp; | 737 return tmp; |
738 #endif | 738 #endif |
739 } | 739 } |
740 | 740 |
741 Uint32 | 741 Uint32 |
742 SDL_AtomicDecrementThenFetch32(Uint32 * ptr) | 742 SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr) |
743 { | 743 { |
744 #ifdef nativeDecrementThenFetch32 | 744 #ifdef nativeDecrementThenFetch32 |
745 return nativeDecrementThenFetch32(ptr); | 745 return nativeDecrementThenFetch32(ptr); |
746 #else | 746 #else |
747 Uint32 tmp = 0; | 747 Uint32 tmp = 0; |
754 return tmp; | 754 return tmp; |
755 #endif | 755 #endif |
756 } | 756 } |
757 | 757 |
758 Uint32 | 758 Uint32 |
759 SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value) | 759 SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value) |
760 { | 760 { |
761 #ifdef nativeAddThenFetch32 | 761 #ifdef nativeAddThenFetch32 |
762 return nativeAddThenFetch32(ptr, value); | 762 return nativeAddThenFetch32(ptr, value); |
763 #else | 763 #else |
764 Uint32 tmp = 0; | 764 Uint32 tmp = 0; |
771 return tmp; | 771 return tmp; |
772 #endif | 772 #endif |
773 } | 773 } |
774 | 774 |
775 Uint32 | 775 Uint32 |
776 SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value) | 776 SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value) |
777 { | 777 { |
778 #ifdef nativeSubtractThenFetch32 | 778 #ifdef nativeSubtractThenFetch32 |
779 return nativeSubtractThenFetch32(ptr, value); | 779 return nativeSubtractThenFetch32(ptr, value); |
780 #else | 780 #else |
781 Uint32 tmp = 0; | 781 Uint32 tmp = 0; |
791 | 791 |
792 /* 64 bit atomic operations */ | 792 /* 64 bit atomic operations */ |
793 #ifdef SDL_HAS_64BIT_TYPE | 793 #ifdef SDL_HAS_64BIT_TYPE |
794 | 794 |
795 Uint64 | 795 Uint64 |
796 SDL_AtomicExchange64(Uint64 * ptr, Uint64 value) | 796 SDL_AtomicExchange64(volatile Uint64 * ptr, Uint64 value) |
797 { | 797 { |
798 #ifdef nativeExchange64 | 798 #ifdef nativeExchange64 |
799 return nativeExchange64(ptr, value); | 799 return nativeExchange64(ptr, value); |
800 #else | 800 #else |
801 Uint64 tmp = 0; | 801 Uint64 tmp = 0; |
808 return tmp; | 808 return tmp; |
809 #endif | 809 #endif |
810 } | 810 } |
811 | 811 |
812 SDL_bool | 812 SDL_bool |
813 SDL_AtomicCompareThenSet64(Uint64 * ptr, Uint64 oldvalue, Uint64 newvalue) | 813 SDL_AtomicCompareThenSet64(volatile Uint64 * ptr, Uint64 oldvalue, Uint64 newvalue) |
814 { | 814 { |
815 #ifdef nativeCompareThenSet64 | 815 #ifdef nativeCompareThenSet64 |
816 return (SDL_bool)nativeCompareThenSet64(ptr, oldvalue, newvalue); | 816 return (SDL_bool)nativeCompareThenSet64(ptr, oldvalue, newvalue); |
817 #else | 817 #else |
818 SDL_bool result = SDL_FALSE; | 818 SDL_bool result = SDL_FALSE; |
828 return result; | 828 return result; |
829 #endif | 829 #endif |
830 } | 830 } |
831 | 831 |
832 SDL_bool | 832 SDL_bool |
833 SDL_AtomicTestThenSet64(Uint64 * ptr) | 833 SDL_AtomicTestThenSet64(volatile Uint64 * ptr) |
834 { | 834 { |
835 #ifdef nativeTestThenSet64 | 835 #ifdef nativeTestThenSet64 |
836 return (SDL_bool)nativeTestThenSet64(ptr); | 836 return (SDL_bool)nativeTestThenSet64(ptr); |
837 #else | 837 #else |
838 SDL_bool result = SDL_FALSE; | 838 SDL_bool result = SDL_FALSE; |
848 return result; | 848 return result; |
849 #endif | 849 #endif |
850 } | 850 } |
851 | 851 |
852 void | 852 void |
853 SDL_AtomicClear64(Uint64 * ptr) | 853 SDL_AtomicClear64(volatile Uint64 * ptr) |
854 { | 854 { |
855 #ifdef nativeClear64 | 855 #ifdef nativeClear64 |
856 nativeClear64(ptr); | 856 nativeClear64(ptr); |
857 #else | 857 #else |
858 privateWaitLock(); | 858 privateWaitLock(); |
862 return; | 862 return; |
863 #endif | 863 #endif |
864 } | 864 } |
865 | 865 |
866 Uint64 | 866 Uint64 |
867 SDL_AtomicFetchThenIncrement64(Uint64 * ptr) | 867 SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr) |
868 { | 868 { |
869 #ifdef nativeFetchThenIncrement64 | 869 #ifdef nativeFetchThenIncrement64 |
870 return nativeFetchThenIncrement64(ptr); | 870 return nativeFetchThenIncrement64(ptr); |
871 #else | 871 #else |
872 Uint64 tmp = 0; | 872 Uint64 tmp = 0; |
879 return tmp; | 879 return tmp; |
880 #endif | 880 #endif |
881 } | 881 } |
882 | 882 |
883 Uint64 | 883 Uint64 |
884 SDL_AtomicFetchThenDecrement64(Uint64 * ptr) | 884 SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr) |
885 { | 885 { |
886 #ifdef nativeFetchThenDecrement64 | 886 #ifdef nativeFetchThenDecrement64 |
887 return nativeFetchThenDecrement64(ptr); | 887 return nativeFetchThenDecrement64(ptr); |
888 #else | 888 #else |
889 Uint64 tmp = 0; | 889 Uint64 tmp = 0; |
896 return tmp; | 896 return tmp; |
897 #endif | 897 #endif |
898 } | 898 } |
899 | 899 |
900 Uint64 | 900 Uint64 |
901 SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value) | 901 SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value) |
902 { | 902 { |
903 #ifdef nativeFetchThenAdd64 | 903 #ifdef nativeFetchThenAdd64 |
904 return nativeFetchThenAdd64(ptr, value); | 904 return nativeFetchThenAdd64(ptr, value); |
905 #else | 905 #else |
906 Uint64 tmp = 0; | 906 Uint64 tmp = 0; |
913 return tmp; | 913 return tmp; |
914 #endif | 914 #endif |
915 } | 915 } |
916 | 916 |
917 Uint64 | 917 Uint64 |
918 SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value) | 918 SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value) |
919 { | 919 { |
920 #ifdef nativeFetchThenSubtract64 | 920 #ifdef nativeFetchThenSubtract64 |
921 return nativeFetchThenSubtract64(ptr, value); | 921 return nativeFetchThenSubtract64(ptr, value); |
922 #else | 922 #else |
923 Uint64 tmp = 0; | 923 Uint64 tmp = 0; |
930 return tmp; | 930 return tmp; |
931 #endif | 931 #endif |
932 } | 932 } |
933 | 933 |
934 Uint64 | 934 Uint64 |
935 SDL_AtomicIncrementThenFetch64(Uint64 * ptr) | 935 SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr) |
936 { | 936 { |
937 #ifdef nativeIncrementThenFetch64 | 937 #ifdef nativeIncrementThenFetch64 |
938 return nativeIncrementThenFetch64(ptr); | 938 return nativeIncrementThenFetch64(ptr); |
939 #else | 939 #else |
940 Uint64 tmp = 0; | 940 Uint64 tmp = 0; |
947 return tmp; | 947 return tmp; |
948 #endif | 948 #endif |
949 } | 949 } |
950 | 950 |
951 Uint64 | 951 Uint64 |
952 SDL_AtomicDecrementThenFetch64(Uint64 * ptr) | 952 SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr) |
953 { | 953 { |
954 #ifdef nativeDecrementThenFetch64 | 954 #ifdef nativeDecrementThenFetch64 |
955 return nativeDecrementThenFetch64(ptr); | 955 return nativeDecrementThenFetch64(ptr); |
956 #else | 956 #else |
957 Uint64 tmp = 0; | 957 Uint64 tmp = 0; |
964 return tmp; | 964 return tmp; |
965 #endif | 965 #endif |
966 } | 966 } |
967 | 967 |
968 Uint64 | 968 Uint64 |
969 SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value) | 969 SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value) |
970 { | 970 { |
971 #ifdef nativeAddThenFetch64 | 971 #ifdef nativeAddThenFetch64 |
972 return nativeAddThenFetch64(ptr, value); | 972 return nativeAddThenFetch64(ptr, value); |
973 #else | 973 #else |
974 Uint64 tmp = 0; | 974 Uint64 tmp = 0; |
981 return tmp; | 981 return tmp; |
982 #endif | 982 #endif |
983 } | 983 } |
984 | 984 |
985 Uint64 | 985 Uint64 |
986 SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value) | 986 SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value) |
987 { | 987 { |
988 #ifdef nativeSubtractThenFetch64 | 988 #ifdef nativeSubtractThenFetch64 |
989 return nativeSubtractThenFetch64(ptr, value); | 989 return nativeSubtractThenFetch64(ptr, value); |
990 #else | 990 #else |
991 Uint64 tmp = 0; | 991 Uint64 tmp = 0; |