Department of Scientific Computing   
Institute for Numerical Simulation   
University of Bonn   
Documentation
Download
Programming References
Bug Reports / Suggestions
FAQ
Authors
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

UDF.cc

00001 #include "UDF.h"
00002 int  UDF_CPUisBigEndian() {
00003  int a=1 ;
00004  int i=sizeof(int) ;
00005  char *b ;
00006  
00007  b=((char *)&a) + (i-1) ;
00008  if (*b) return 1 ;
00009  else    return 0 ;
00010 }
00011 
00012 void UDF_swap(void *p, size_t size, size_t nitem) {
00013   /* assert((size&1)==0) ; */
00014  
00015  char *p1=(char *)p , a ;
00016   
00017  for (unsigned int j=0; j<nitem; j++) {
00018    for (unsigned int i=0; i<size/2; i++) {
00019      a           =p1[i] ;
00020      p1[i]       =p1[size-1-i] ;
00021      p1[size-1-i]=a ;
00022    }
00023    p1=&p1[size] ;
00024  } 
00025 }
00026 

Generated at Mon Aug 19 10:02:32 2002 for AWFD by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001