gpp4 1.3.1

src/ccp4_types.h

Go to the documentation of this file.
00001 /*
00002      ccp4_types.h: CCP4 library.c macro definitions etc
00003      Copyright (C) 2001  CCLRC
00004      Copyright (C) 2007  Morten Kjeldgaard
00005 
00006      This library is free software: you can redistribute it and/or
00007      modify it under the terms of the GNU Lesser General Public
00008      License as published by the Free Software Foundation, either
00009      version 3 of the License, or (at your option) any later version.
00010 
00011      This library is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014      Lesser General Public License for more details.
00015 
00016      You should have received a copy of the GNU Lesser General Public
00017      License along with This library.  If not, see
00018      <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00027 #ifndef __CCP4_TYPES
00028 #define __CCP4_TYPES
00029 
00030 #include "ccp4_sysdep.h"
00031 
00032 typedef unsigned short uint16;
00033 #ifdef SIXTEENBIT
00034 typedef unsigned long uint32;
00035 #else
00036 typedef unsigned int uint32;
00037 #endif
00038 typedef float float32;
00039 typedef unsigned char uint8;
00040 
00044 union float_uint_uchar {
00045   float32 f;                    
00046   uint32 i;                     
00047   uint8 c[4];                   
00048   };
00049 
00051 typedef char *pstr;             
00052 
00053 /* CCP4 library.c macro definitions */
00054 
00055 #ifndef FALSE
00056 #define FALSE 0
00057 #define TRUE 1
00058 #endif
00059 
00063 typedef struct { double r;             
00064                  double i;             
00065                } COMPLEX;              
00070 typedef struct { double r;             
00071                  double phi;           
00072                } POLAR;                
00074 /* some simple macros, which may exist anyway */
00075 
00079 #ifndef SQR
00080 #define SQR(x) ((x)*(x))
00081 #endif
00082 
00087 #ifndef DEGREE
00088 #define DEGREE(x) ((((x < 0)?(x)+2*M_PI:(x))*360)/(2*M_PI))
00089 #endif
00090 
00095 #ifndef RADIAN
00096 #define RADIAN(x) ((((x<0)?(x)+360:(x))*2*M_PI)/360)
00097 #endif
00098 
00102 #ifndef MAX
00103 #define MAX(x, y) (((x)>(y))?(x):(y))
00104 #endif
00105 
00109 #ifndef MIN
00110 #define MIN(x, y) (((x)<(y))?(x):(y))
00111 #endif
00112 
00116 #ifndef ABS
00117 #define ABS(x) (((x)<0)?-(x):(x))
00118 #endif
00119 
00123 #ifndef SIGN
00124 #define SIGN(x) (((x)<0)?-1:1)
00125 #endif
00126 
00127 #endif   /* __CCP4_TYPES */
00128 
00129 /*
00130   Local variables:
00131   mode: font-lock
00132   End:
00133 */