/[dtapublic]/projs/trunk/shared_source/c_datd/intfunc.c
ViewVC logotype

Diff of /projs/trunk/shared_source/c_datd/intfunc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 56 by dashley, Sat Oct 29 01:53:01 2016 UTC revision 71 by dashley, Sat Nov 5 11:07:06 2016 UTC
# Line 1  Line 1 
1  //$Header$  //$Header$
2  //-------------------------------------------------------------------------------------------------  //-------------------------------------------------------------------------------------------------
3  //This file is part of "David T. Ashley's Shared Source Code", a set of shared components  //This file is part of "David T. Ashley's Shared Source Code", a set of shared components
4  //integrated into many of David T. Ashley's projects.  //integrated into many of David T. Ashley's projects.
5  //-------------------------------------------------------------------------------------------------  //-------------------------------------------------------------------------------------------------
6  //This source code and any program in which it is compiled/used is provided under the MIT License,  //This source code and any program in which it is compiled/used is provided under the MIT License,
7  //reproduced below.  //reproduced below.
8  //-------------------------------------------------------------------------------------------------  //-------------------------------------------------------------------------------------------------
9  //Permission is hereby granted, free of charge, to any person obtaining a copy of  //Permission is hereby granted, free of charge, to any person obtaining a copy of
10  //this software and associated documentation files(the "Software"), to deal in the  //this software and associated documentation files(the "Software"), to deal in the
11  //Software without restriction, including without limitation the rights to use,  //Software without restriction, including without limitation the rights to use,
12  //copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the  //copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the
13  //Software, and to permit persons to whom the Software is furnished to do so,  //Software, and to permit persons to whom the Software is furnished to do so,
14  //subject to the following conditions :  //subject to the following conditions :
15  //  //
16  //The above copyright notice and this permission notice shall be included in all  //The above copyright notice and this permission notice shall be included in all
17  //copies or substantial portions of the Software.  //copies or substantial portions of the Software.
18  //  //
19  //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE  //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
22  //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  //SOFTWARE.  //SOFTWARE.
26  //-------------------------------------------------------------------------------------------------  //-------------------------------------------------------------------------------------------------
27  #define MODULE_INTFUNC  #define MODULE_INTFUNC
28    
29  #include "intfunc.h"  #include "intfunc.h"
30    
31    
32  //08/16/01: Visual inspection OK.  //08/16/01: Visual inspection OK.
33  int INTFUNC_max(int a, int b)  int INTFUNC_max(int a, int b)
34     {     {
35     if (a > b)     if (a > b)
36        return(a);        return(a);
37     else     else
38        return(b);        return(b);
39     }     }
40    
41    
42  //08/16/01: Visual inspection OK.  //08/16/01: Visual inspection OK.
43  int INTFUNC_min(int a, int b)  int INTFUNC_min(int a, int b)
44     {     {
45     if (a < b)     if (a < b)
46        return(a);        return(a);
47     else     else
48        return(b);        return(b);
49     }     }
50    
51    
52  //08/16/01: Visual inspection OK.  //08/16/01: Visual inspection OK.
53  int INTFUNC_is_even(int arg)  int INTFUNC_is_even(int arg)
54     {     {
55     if ((arg & 0x1) == 0)     if ((arg & 0x1) == 0)
56        return(1);        return(1);
57     else     else
58        return(0);        return(0);
59     }     }
60    
61    
62  //08/16/01: Visual inspection OK.  //08/16/01: Visual inspection OK.
63  int INTFUNC_is_odd(int arg)  int INTFUNC_is_odd(int arg)
64     {     {
65     if ((arg & 0x1) == 1)     if ((arg & 0x1) == 1)
66        return(1);        return(1);
67     else     else
68        return(0);        return(0);
69     }     }
70    
71    
72  unsigned int INTFUNC_rn_power_res_16807_mapping(unsigned int arg_in)  unsigned int INTFUNC_rn_power_res_16807_mapping(unsigned int arg_in)
73     {     {
74     unsigned __int64 arg_local;     unsigned __int64 arg_local;
75    
76     arg_local =  arg_in;     arg_local =  arg_in;
77     arg_local *= (unsigned __int64)16807;     arg_local *= (unsigned __int64)16807;
78     arg_local %= (unsigned __int64)2147483647;     arg_local %= (unsigned __int64)2147483647;
79    
80     return((unsigned int)arg_local);     return((unsigned int)arg_local);
81     }     }
82    
83    
84  //08/16/01: Visual inspection OK.  //08/16/01: Visual inspection OK.
85  const char *INTFUNC_cvcinfo(void)  const char *INTFUNC_cvcinfo(void)
86     {     {
87     return("$Header$");     return("$Header$");
88     }     }
89    
90    
91  //08/16/01: Visual inspection OK.  //08/16/01: Visual inspection OK.
92  const char *INTFUNC_hvcinfo(void)  const char *INTFUNC_hvcinfo(void)
93     {     {
94     return(INTFUNC_H_VERSION);     return(INTFUNC_H_VERSION);
95     }     }
96    
97  //End of intfunc.c.  //End of intfunc.c.

Legend:
Removed from v.56  
changed lines
  Added in v.71

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25