Merge branch 'release-v4.6.0' of github.com:wrf-model/WRF
[WRF.git] / frame / wrf_num_bytes_between.c
blob5f95739f6b21cbd15ca54792f1d098af686a9746
1 #include <stdio.h>
3 #ifndef CRAY
4 # ifdef NOUNDERSCORE
5 # define WRF_NUM_BYTES_BETWEEN wrf_num_bytes_between
6 # define GET_INITIAL_DATA_VALUE get_initial_data_value
7 # define WHAT_IS_A_NAN what_is_a_nan
8 # define WRF_MEM_COPY wrf_mem_copy
9 # else
10 # ifdef F2CSTYLE
11 # define WRF_NUM_BYTES_BETWEEN wrf_num_bytes_between__
12 # define GET_INITIAL_DATA_VALUE get_initial_data_value__
13 # define WHAT_IS_A_NAN what_is_a_nan__
14 # define WRF_MEM_COPY wrf_mem_copy__
15 # else
16 # define WRF_NUM_BYTES_BETWEEN wrf_num_bytes_between_
17 # define GET_INITIAL_DATA_VALUE get_initial_data_value_
18 # define WHAT_IS_A_NAN what_is_a_nan_
19 # define WRF_MEM_COPY wrf_mem_copy_
20 # endif
21 # endif
22 #endif
24 void
25 WRF_NUM_BYTES_BETWEEN ( a , b , n )
26 char * a ;
27 char * b ;
28 int * n ;
30 *n = a - b ;
31 if ( *n < 0 ) *n = -(*n) ;
34 /*#define NAN_VALUE */
35 #ifdef NAN_VALUE
36 void
37 GET_INITIAL_DATA_VALUE ( n )
38 int * n ;
40 *n = 0xffc00000 ;
42 #else
43 void
44 GET_INITIAL_DATA_VALUE ( n )
45 float * n ;
47 *n = 0. ;
49 #endif
51 void
52 WHAT_IS_A_NAN ( n )
53 int * n ;
55 *n = 0xffc00000 ;
56 #if 0
57 *n = 0. ;
58 fprintf(stderr,"WHAT_IS_NAN disabled\n") ;
59 #endif
62 /* SUBROUTINE wrf_mem_copy( a, b, n )
63 INTEGER*1, INTENT (INOUT) :: a(*), b(*)
64 INTEGER, INTENT (IN) :: n
65 INTEGER :: i
66 DO i = 1, n
67 b(i) = a(i)
68 ENDDO
69 RETURN
70 END SUBROUTINE wrf_mem_copy */
72 void
73 WRF_MEM_COPY ( a , b, n )
74 char * a ;
75 char * b ;
76 int * n ;
78 int i ;
79 for ( i = 0 ; i < *n ; i++ )
81 *b++ = *a++ ;