summaryrefslogtreecommitdiff
blob: ee52c32e53fe53f6cb72f59f7c14ba9a614a0c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
This is a bit packported upstream commit patch, that removes vtkAtomic
and switches codebase to use std::atomic. This patch is kinda required
for patchset for supporting modern versions of dev-cpp/tbb.

Patch backported by Vadim Misbakh-Solovov <mva@gentoo.org>

Original patch url: https://gitlab.kitware.com/vtk/vtk/-/commit/4ca62d8c73.patch

--- a/Common/Core/CMakeLists.txt
+++ b/Common/Core/CMakeLists.txt
@@ -266,7 +266,6 @@ set(headers
   vtkArchiver.h
   vtkArrayIteratorIncludes.h
   vtkAssume.h
-  vtkAtomicTypeConcepts.h
   vtkAutoInit.h
   vtkBuffer.h
   vtkCollectionRange.h
--- a/Common/Core/SMP/OpenMP/vtkAtomic.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/*=========================================================================
-
-  Program:   Visualization Toolkit
-  Module:    vtkAtomic.cxx
-
-  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
-  All rights reserved.
-  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-     PURPOSE.  See the above copyright notice for more information.
-
-=========================================================================*/
-
-#include "vtkAtomic.h"
-
-namespace detail
-{
-
-vtkTypeInt64 AtomicOps<8>::AddAndFetch(vtkTypeInt64* ref, vtkTypeInt64 val)
-{
-  vtkTypeInt64 result;
-#pragma omp atomic capture
-  {
-    (*ref) += val;
-    result = *ref;
-  }
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt64 AtomicOps<8>::SubAndFetch(vtkTypeInt64* ref, vtkTypeInt64 val)
-{
-  vtkTypeInt64 result;
-#pragma omp atomic capture
-  {
-    (*ref) -= val;
-    result = *ref;
-  }
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt64 AtomicOps<8>::PreIncrement(vtkTypeInt64* ref)
-{
-  vtkTypeInt64 result;
-#pragma omp atomic capture
-  result = ++(*ref);
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt64 AtomicOps<8>::PreDecrement(vtkTypeInt64* ref)
-{
-  vtkTypeInt64 result;
-#pragma omp atomic capture
-  result = --(*ref);
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt64 AtomicOps<8>::PostIncrement(vtkTypeInt64* ref)
-{
-  vtkTypeInt64 result;
-#pragma omp atomic capture
-  result = (*ref)++;
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt64 AtomicOps<8>::PostDecrement(vtkTypeInt64* ref)
-{
-  vtkTypeInt64 result;
-#pragma omp atomic capture
-  result = (*ref)--;
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt64 AtomicOps<8>::Load(const vtkTypeInt64* ref)
-{
-  vtkTypeInt64 result;
-#pragma omp flush
-#pragma omp atomic read
-  result = *ref;
-  return result;
-}
-
-void AtomicOps<8>::Store(vtkTypeInt64* ref, vtkTypeInt64 val)
-{
-#pragma omp atomic write
-  *ref = val;
-#pragma omp flush
-}
-
-vtkTypeInt32 AtomicOps<4>::AddAndFetch(vtkTypeInt32* ref, vtkTypeInt32 val)
-{
-  vtkTypeInt32 result;
-#pragma omp atomic capture
-  {
-    (*ref) += val;
-    result = *ref;
-  }
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt32 AtomicOps<4>::SubAndFetch(vtkTypeInt32* ref, vtkTypeInt32 val)
-{
-  vtkTypeInt32 result;
-#pragma omp atomic capture
-  {
-    (*ref) -= val;
-    result = *ref;
-  }
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt32 AtomicOps<4>::PreIncrement(vtkTypeInt32* ref)
-{
-  vtkTypeInt32 result;
-#pragma omp atomic capture
-  result = ++(*ref);
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt32 AtomicOps<4>::PreDecrement(vtkTypeInt32* ref)
-{
-  vtkTypeInt32 result;
-#pragma omp atomic capture
-  result = --(*ref);
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt32 AtomicOps<4>::PostIncrement(vtkTypeInt32* ref)
-{
-  vtkTypeInt32 result;
-#pragma omp atomic capture
-  result = (*ref)++;
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt32 AtomicOps<4>::PostDecrement(vtkTypeInt32* ref)
-{
-  vtkTypeInt32 result;
-#pragma omp atomic capture
-  result = (*ref)--;
-#pragma omp flush
-  return result;
-}
-
-vtkTypeInt32 AtomicOps<4>::Load(const vtkTypeInt32* ref)
-{
-  vtkTypeInt32 result;
-#pragma omp flush
-#pragma omp atomic read
-  result = *ref;
-  return result;
-}
-
-void AtomicOps<4>::Store(vtkTypeInt32* ref, vtkTypeInt32 val)
-{
-#pragma omp atomic write
-  *ref = val;
-#pragma omp flush
-}
-
-}
--- a/Common/Core/SMP/OpenMP/vtkAtomic.h.in
+++ /dev/null
@@ -1,293 +0,0 @@
-/*=========================================================================
-
-  Program:   Visualization Toolkit
-  Module:    vtkAtomic.h
-
-  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
-  All rights reserved.
-  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-     PURPOSE.  See the above copyright notice for more information.
-
-=========================================================================*/
-// .NAME vtkAtomic -
-// .SECTION Description
-
-#ifndef vtkAtomic_h
-#define vtkAtomic_h
-
-#include "vtkCommonCoreModule.h" // For export macro
-#include "vtkAtomicTypeConcepts.h"
-#include "vtkSystemIncludes.h"
-
-#include <cstddef>
-
-
-#ifndef __VTK_WRAP__
-namespace detail
-{
-
-template <size_t size> class AtomicOps;
-
-template <> class VTKCOMMONCORE_EXPORT AtomicOps<8>
-{
-public:
-  typedef vtkTypeInt64 atomic_type;
-
-  static vtkTypeInt64 AddAndFetch(vtkTypeInt64 *ref, vtkTypeInt64 val);
-  static vtkTypeInt64 SubAndFetch(vtkTypeInt64 *ref, vtkTypeInt64 val);
-  static vtkTypeInt64 PreIncrement(vtkTypeInt64 *ref);
-  static vtkTypeInt64 PreDecrement(vtkTypeInt64 *ref);
-  static vtkTypeInt64 PostIncrement(vtkTypeInt64 *ref);
-  static vtkTypeInt64 PostDecrement(vtkTypeInt64 *ref);
-  static vtkTypeInt64 Load(const vtkTypeInt64 *ref);
-  static void Store(vtkTypeInt64 *ref, vtkTypeInt64 val);
-};
-
-template <> class VTKCOMMONCORE_EXPORT AtomicOps<4>
-{
-public:
-  typedef vtkTypeInt32 atomic_type;
-
-  static vtkTypeInt32 AddAndFetch(vtkTypeInt32 *ref, vtkTypeInt32 val);
-  static vtkTypeInt32 SubAndFetch(vtkTypeInt32 *ref, vtkTypeInt32 val);
-  static vtkTypeInt32 PreIncrement(vtkTypeInt32 *ref);
-  static vtkTypeInt32 PreDecrement(vtkTypeInt32 *ref);
-  static vtkTypeInt32 PostIncrement(vtkTypeInt32 *ref);
-  static vtkTypeInt32 PostDecrement(vtkTypeInt32 *ref);
-  static vtkTypeInt32 Load(const vtkTypeInt32 *ref);
-  static void Store(vtkTypeInt32 *ref, vtkTypeInt32 val);
-};
-
-} // detail
-#endif // __VTK_WRAP__
-
-
-template <typename T> class vtkAtomic : private vtk::atomic::detail::IntegralType<T>
-{
-private:
-  typedef detail::AtomicOps<sizeof(T)> Impl;
-
-public:
-  vtkAtomic() : Atomic(0)
-  {
-  }
-
-  vtkAtomic(T val) : Atomic(static_cast<typename Impl::atomic_type>(val))
-  {
-  }
-
-  vtkAtomic(const vtkAtomic<T> &atomic)
-    : Atomic(static_cast<typename Impl::atomic_type>(atomic.load()))
-  {
-  }
-
-  T operator++()
-  {
-    return static_cast<T>(Impl::PreIncrement(&this->Atomic));
-  }
-
-  T operator++(int)
-  {
-    return static_cast<T>(Impl::PostIncrement(&this->Atomic));
-  }
-
-  T operator--()
-  {
-    return static_cast<T>(Impl::PreDecrement(&this->Atomic));
-  }
-
-  T operator--(int)
-  {
-    return static_cast<T>(Impl::PostDecrement(&this->Atomic));
-  }
-
-  T operator+=(T val)
-  {
-    return static_cast<T>(Impl::AddAndFetch(&this->Atomic,
-      static_cast<typename Impl::atomic_type>(val)));
-  }
-
-  T operator-=(T val)
-  {
-    return static_cast<T>(Impl::SubAndFetch(&this->Atomic,
-      static_cast<typename Impl::atomic_type>(val)));
-  }
-
-  operator T() const
-  {
-    return static_cast<T>(Impl::Load(&this->Atomic));
-  }
-
-  T operator=(T val)
-  {
-    Impl::Store(&this->Atomic, static_cast<typename Impl::atomic_type>(val));
-    return val;
-  }
-
-  vtkAtomic<T>& operator=(const vtkAtomic<T> &atomic)
-  {
-    this->store(atomic.load());
-    return *this;
-  }
-
-  T load() const
-  {
-    return static_cast<T>(Impl::Load(&this->Atomic));
-  }
-
-  void store(T val)
-  {
-    Impl::Store(&this->Atomic, static_cast<typename Impl::atomic_type>(val));
-  }
-
-private:
-  typename Impl::atomic_type Atomic;
-};
-
-
-template <typename T> class vtkAtomic<T*>
-{
-private:
-  typedef detail::AtomicOps<sizeof(T*)> Impl;
-
-public:
-  vtkAtomic() : Atomic(0)
-  {
-  }
-
-  vtkAtomic(T* val)
-    : Atomic(reinterpret_cast<typename Impl::atomic_type>(val))
-  {
-  }
-
-  vtkAtomic(const vtkAtomic<T*> &atomic)
-    : Atomic(reinterpret_cast<typename Impl::atomic_type>(atomic.load()))
-  {
-  }
-
-  T* operator++()
-  {
-    return reinterpret_cast<T*>(Impl::AddAndFetch(&this->Atomic, sizeof(T)));
-  }
-
-  T* operator++(int)
-  {
-    T* val = reinterpret_cast<T*>(Impl::AddAndFetch(&this->Atomic, sizeof(T)));
-    return --val;
-  }
-
-  T* operator--()
-  {
-    return reinterpret_cast<T*>(Impl::SubAndFetch(&this->Atomic, sizeof(T)));
-  }
-
-  T* operator--(int)
-  {
-    T* val = reinterpret_cast<T*>(Impl::AddAndFetch(&this->Atomic, sizeof(T)));
-    return ++val;
-  }
-
-  T* operator+=(std::ptrdiff_t val)
-  {
-    return reinterpret_cast<T*>(Impl::AddAndFetch(&this->Atomic,
-                                                  val * sizeof(T)));
-  }
-
-  T* operator-=(std::ptrdiff_t val)
-  {
-    return reinterpret_cast<T*>(Impl::SubAndFetch(&this->Atomic,
-                                                  val * sizeof(T)));
-  }
-
-  operator T*() const
-  {
-    return reinterpret_cast<T*>(Impl::Load(&this->Atomic));
-  }
-
-  T* operator=(T* val)
-  {
-    Impl::Store(&this->Atomic,
-                reinterpret_cast<typename Impl::atomic_type>(val));
-    return val;
-  }
-
-  vtkAtomic<T*>& operator=(const vtkAtomic<T*> &atomic)
-  {
-    this->store(atomic.load());
-    return *this;
-  }
-
-  T* load() const
-  {
-    return reinterpret_cast<T*>(Impl::Load(&this->Atomic));
-  }
-
-  void store(T* val)
-  {
-    Impl::Store(&this->Atomic,
-                reinterpret_cast<typename Impl::atomic_type>(val));
-  }
-
-private:
-  typename Impl::atomic_type Atomic;
-};
-
-
-template <> class vtkAtomic<void*>
-{
-private:
-  typedef detail::AtomicOps<sizeof(void*)> Impl;
-
-public:
-  vtkAtomic() : Atomic(0)
-  {
-  }
-
-  vtkAtomic(void* val)
-    : Atomic(reinterpret_cast<Impl::atomic_type>(val))
-  {
-  }
-
-  vtkAtomic(const vtkAtomic<void*> &atomic)
-    : Atomic(reinterpret_cast<Impl::atomic_type>(atomic.load()))
-  {
-  }
-
-  operator void*() const
-  {
-    return reinterpret_cast<void*>(Impl::Load(&this->Atomic));
-  }
-
-  void* operator=(void* val)
-  {
-    Impl::Store(&this->Atomic,
-                reinterpret_cast<Impl::atomic_type>(val));
-    return val;
-  }
-
-  vtkAtomic<void*>& operator=(const vtkAtomic<void*> &atomic)
-  {
-    this->store(atomic.load());
-    return *this;
-  }
-
-  void* load() const
-  {
-    return reinterpret_cast<void*>(Impl::Load(&this->Atomic));
-  }
-
-  void store(void* val)
-  {
-    Impl::Store(&this->Atomic,
-                reinterpret_cast<Impl::atomic_type>(val));
-  }
-
-private:
-  Impl::atomic_type Atomic;
-};
-
-#endif
-// VTK-HeaderTest-Exclude: vtkAtomic.h
--- a/Common/Core/SMP/OpenMP/vtkSMPThreadLocalImpl.h.in
+++ b/Common/Core/SMP/OpenMP/vtkSMPThreadLocalImpl.h.in
@@ -33,7 +33,6 @@
 #define vtkSMPThreadLocalImpl_h
 
 #include "vtkCommonCoreModule.h" // For export macro
-#include "vtkAtomic.h"
 #include "vtkConfigure.h"
 #include "vtkSystemIncludes.h"
 
 #include <atomic>
@@ -49,7 +49,7 @@ typedef void* StoragePointerType;
 
 struct Slot
 {
-  vtkAtomic<ThreadIdType> ThreadId;
+  std::atomic<ThreadIdType> ThreadId;
   omp_lock_t ModifyLock;
   StoragePointerType Storage;
 
@@ -66,7 +66,7 @@ private:
 struct HashTableArray
 {
   size_t Size, SizeLg;
-  vtkAtomic<size_t> NumberOfEntries;
+  std::atomic<size_t> NumberOfEntries;
   Slot *Slots;
   HashTableArray *Prev;
 
@@ -90,8 +90,8 @@ public:
   size_t Size() const;
 
 private:
-  vtkAtomic<HashTableArray*> Root;
-  vtkAtomic<size_t> Count;
+  std::atomic<HashTableArray*> Root;
+  std::atomic<size_t> Count;
 
   friend class ThreadSpecificStorageIterator;
 };
--- a/Common/Core/SMP/Sequential/vtkAtomic.cxx
+++ /dev/null
@@ -1,278 +0,0 @@
-/*=========================================================================
-
-  Program:   Visualization Toolkit
-  Module:    vtkAtomic.cxx
-
-  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
-  All rights reserved.
-  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-     PURPOSE.  See the above copyright notice for more information.
-
-=========================================================================*/
-
-#include "vtkAtomic.h"
-
-#if !defined(VTK_GCC_ATOMICS_32) && !defined(VTK_APPLE_ATOMICS_32) &&                              \
-  !defined(VTK_WINDOWS_ATOMICS_32)
-#define VTK_LOCK_BASED_ATOMICS_32
-#endif
-
-#if !defined(VTK_GCC_ATOMICS_64) && !defined(VTK_APPLE_ATOMICS_64) &&                              \
-  !defined(VTK_WINDOWS_ATOMICS_64)
-#define VTK_LOCK_BASED_ATOMICS_64
-#endif
-
-#if defined(VTK_WINDOWS_ATOMICS_32) || defined(VTK_WINDOWS_ATOMICS_64)
-#include "vtkWindows.h"
-#endif
-
-#if defined(VTK_LOCK_BASED_ATOMICS_32) || defined(VTK_LOCK_BASED_ATOMICS_64)
-
-#include "vtkSimpleCriticalSection.h"
-
-class CriticalSectionGuard
-{
-public:
-  CriticalSectionGuard(vtkSimpleCriticalSection& cs)
-    : CriticalSection(cs)
-  {
-    this->CriticalSection.Lock();
-  }
-
-  ~CriticalSectionGuard() { this->CriticalSection.Unlock(); }
-
-private:
-  // not copyable
-  CriticalSectionGuard(const CriticalSectionGuard&);
-  void operator=(const CriticalSectionGuard&);
-
-  vtkSimpleCriticalSection& CriticalSection;
-};
-
-#if defined(VTK_LOCK_BASED_ATOMICS_64)
-detail::AtomicOps<8>::atomic_type::atomic_type(vtkTypeInt64 init)
-  : var(init)
-{
-  this->csec = new vtkSimpleCriticalSection;
-}
-
-detail::AtomicOps<8>::atomic_type::~atomic_type()
-{
-  delete this->csec;
-}
-#endif
-
-#if defined(VTK_LOCK_BASED_ATOMICS_32)
-detail::AtomicOps<4>::atomic_type::atomic_type(vtkTypeInt32 init)
-  : var(init)
-{
-  this->csec = new vtkSimpleCriticalSection;
-}
-
-detail::AtomicOps<4>::atomic_type::~atomic_type()
-{
-  delete this->csec;
-}
-#endif
-
-#endif // VTK_LOCK_BASED_ATOMICS
-
-namespace detail
-{
-
-#if defined(VTK_WINDOWS_ATOMICS_64) || defined(VTK_LOCK_BASED_ATOMICS_64)
-
-vtkTypeInt64 AtomicOps<8>::AddAndFetch(atomic_type* ref, vtkTypeInt64 val)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-#if defined(VTK_HAS_INTERLOCKEDADD)
-  return InterlockedAdd64(ref, val);
-#else
-  return InterlockedExchangeAdd64(ref, val) + val;
-#endif
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ref->var += val;
-#endif
-}
-
-vtkTypeInt64 AtomicOps<8>::SubAndFetch(atomic_type* ref, vtkTypeInt64 val)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-#if defined(VTK_HAS_INTERLOCKEDADD)
-  return InterlockedAdd64(ref, -val);
-#else
-  return InterlockedExchangeAdd64(ref, -val) - val;
-#endif
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ref->var -= val;
-#endif
-}
-
-vtkTypeInt64 AtomicOps<8>::PreIncrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-  return InterlockedIncrement64(ref);
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ++(ref->var);
-#endif
-}
-
-vtkTypeInt64 AtomicOps<8>::PreDecrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-  return InterlockedDecrement64(ref);
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return --(ref->var);
-#endif
-}
-
-vtkTypeInt64 AtomicOps<8>::PostIncrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-  vtkTypeInt64 val = InterlockedIncrement64(ref);
-  return --val;
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return (ref->var)++;
-#endif
-}
-
-vtkTypeInt64 AtomicOps<8>::PostDecrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-  vtkTypeInt64 val = InterlockedDecrement64(ref);
-  return ++val;
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return (ref->var)--;
-#endif
-}
-
-vtkTypeInt64 AtomicOps<8>::Load(const atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-  vtkTypeInt64 val;
-  InterlockedExchange64(&val, *ref);
-  return val;
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ref->var;
-#endif
-}
-
-void AtomicOps<8>::Store(atomic_type* ref, vtkTypeInt64 val)
-{
-#if defined(VTK_WINDOWS_ATOMICS_64)
-  InterlockedExchange64(ref, val);
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  ref->var = val;
-#endif
-}
-
-#endif // defined(VTK_WINDOWS_ATOMICS_64) || defined(VTK_LOCK_BASED_ATOMICS_64)
-
-#if defined(VTK_WINDOWS_ATOMICS_32) || defined(VTK_LOCK_BASED_ATOMICS_32)
-
-vtkTypeInt32 AtomicOps<4>::AddAndFetch(atomic_type* ref, vtkTypeInt32 val)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-#if defined(VTK_HAS_INTERLOCKEDADD)
-  return InterlockedAdd(reinterpret_cast<long*>(ref), val);
-#else
-  return InterlockedExchangeAdd(reinterpret_cast<long*>(ref), val) + val;
-#endif
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ref->var += val;
-#endif
-}
-
-vtkTypeInt32 AtomicOps<4>::SubAndFetch(atomic_type* ref, vtkTypeInt32 val)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-#if defined(VTK_HAS_INTERLOCKEDADD)
-  return InterlockedAdd(reinterpret_cast<long*>(ref), -val);
-#else
-  return InterlockedExchangeAdd(reinterpret_cast<long*>(ref), -val) - val;
-#endif
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ref->var -= val;
-#endif
-}
-
-vtkTypeInt32 AtomicOps<4>::PreIncrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-  return InterlockedIncrement(reinterpret_cast<long*>(ref));
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ++(ref->var);
-#endif
-}
-
-vtkTypeInt32 AtomicOps<4>::PreDecrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-  return InterlockedDecrement(reinterpret_cast<long*>(ref));
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return --(ref->var);
-#endif
-}
-
-vtkTypeInt32 AtomicOps<4>::PostIncrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-  vtkTypeInt32 val = InterlockedIncrement(reinterpret_cast<long*>(ref));
-  return --val;
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return (ref->var)++;
-#endif
-}
-
-vtkTypeInt32 AtomicOps<4>::PostDecrement(atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-  vtkTypeInt32 val = InterlockedDecrement(reinterpret_cast<long*>(ref));
-  return ++val;
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return (ref->var)--;
-#endif
-}
-
-vtkTypeInt32 AtomicOps<4>::Load(const atomic_type* ref)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-  long val;
-  InterlockedExchange(&val, *ref);
-  return val;
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  return ref->var;
-#endif
-}
-
-void AtomicOps<4>::Store(atomic_type* ref, vtkTypeInt32 val)
-{
-#if defined(VTK_WINDOWS_ATOMICS_32)
-  InterlockedExchange(reinterpret_cast<long*>(ref), val);
-#else
-  CriticalSectionGuard csg(*ref->csec);
-  ref->var = val;
-#endif
-}
-
-#endif // defined(VTK_WINDOWS_ATOMICS_32) || defined(VTK_LOCK_BASED_ATOMICS_32)
-
-} // namespace detail