00001 // This is core/vil1/vil1_byte_swap.cxx 00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00003 #pragma implementation 00004 #endif 00005 //: 00006 // \file 00007 // \author fsm 00008 00009 #include "vil1_byte_swap.h" 00010 #include <vcl_cassert.h> 00011 00012 // this is not efficient 00013 void vil1_byte_swap(void *b_, void *e_) { 00014 char *b = static_cast<char*>(b_); 00015 char *e = static_cast<char*>(e_); 00016 assert(b < e); 00017 unsigned long n = e-b; 00018 for (unsigned long i=0; i<n/2; ++i) { 00019 char tmp = b[i]; 00020 b[i] = b[n-1-i]; 00021 b[n-1-i] = tmp; 00022 } 00023 }
1.5.1