# HG changeset patch # User John W. Eaton # Date 1379009441 14400 # Node ID e89e86e1a5518c11058930fec5e907e60e31251b # Parent 95bfa04ab514737bd4f64560107b637923072e70 eliminate unnecessary volatile declarations * byte-swap.h (swap_bytes): Don't declare point arg as volatile. Update all instantiations. * data-conv.cc: Delete explicit instantiations of byte_swap template. diff -r 95bfa04ab514 -r e89e86e1a551 liboctave/util/byte-swap.h --- a/liboctave/util/byte-swap.h Wed Sep 11 16:05:40 2013 -0700 +++ b/liboctave/util/byte-swap.h Thu Sep 12 14:10:41 2013 -0400 @@ -23,13 +23,10 @@ #if !defined (octave_byte_swap_h) #define octave_byte_swap_h 1 -// FIXME -- not sure these volatile qualifiers are really -// needed or appropriate here. - static inline void -swap_bytes (volatile void *ptr, unsigned int i, unsigned int j) +swap_bytes (void *ptr, unsigned int i, unsigned int j) { - volatile char *t = static_cast (ptr); + char *t = static_cast (ptr); char tmp = t[i]; t[i] = t[j]; @@ -38,7 +35,7 @@ template void -swap_bytes (volatile void *ptr) +swap_bytes (void *ptr) { for (int i = 0; i < n/2; i++) swap_bytes (ptr, i, n-1-i); @@ -46,20 +43,20 @@ template <> inline void -swap_bytes <1> (volatile void *) +swap_bytes<1> (void *) { } template <> inline void -swap_bytes <2> (volatile void *ptr) +swap_bytes<2> (void *ptr) { swap_bytes (ptr, 0, 1); } template <> inline void -swap_bytes <4> (volatile void *ptr) +swap_bytes<4> (void *ptr) { swap_bytes (ptr, 0, 3); swap_bytes (ptr, 1, 2); @@ -67,7 +64,7 @@ template <> inline void -swap_bytes <8> (volatile void *ptr) +swap_bytes<8> (void *ptr) { swap_bytes (ptr, 0, 7); swap_bytes (ptr, 1, 6); @@ -77,9 +74,9 @@ template void -swap_bytes (volatile void *ptr, int len) +swap_bytes (void *ptr, int len) { - volatile char *t = static_cast (ptr); + char *t = static_cast (ptr); for (int i = 0; i < len; i++) { @@ -90,7 +87,7 @@ template <> inline void -swap_bytes<1> (volatile void *, int) +swap_bytes<1> (void *, int) { } diff -r 95bfa04ab514 -r e89e86e1a551 liboctave/util/data-conv.cc --- a/liboctave/util/data-conv.cc Wed Sep 11 16:05:40 2013 -0700 +++ b/liboctave/util/data-conv.cc Thu Sep 12 14:10:41 2013 -0400 @@ -37,10 +37,6 @@ #include "lo-ieee.h" #include "oct-locbuf.h" -template void swap_bytes<2> (volatile void *, int); -template void swap_bytes<4> (volatile void *, int); -template void swap_bytes<8> (volatile void *, int); - #if defined HAVE_LONG_LONG_INT #define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \ do \