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

Contents of /projs/trunk/shared_source/c_datd/intfunc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 56 - (show annotations) (download)
Sat Oct 29 01:53:01 2016 UTC (6 years, 3 months ago) by dashley
File MIME type: text/plain
File size: 2994 byte(s)
License and property (keyword) changes.
1 //$Header$
2 //-------------------------------------------------------------------------------------------------
3 //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.
5 //-------------------------------------------------------------------------------------------------
6 //This source code and any program in which it is compiled/used is provided under the MIT License,
7 //reproduced below.
8 //-------------------------------------------------------------------------------------------------
9 //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
11 //Software without restriction, including without limitation the rights to use,
12 //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,
14 //subject to the following conditions :
15 //
16 //The above copyright notice and this permission notice shall be included in all
17 //copies or substantial portions of the Software.
18 //
19 //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 //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
23 //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
25 //SOFTWARE.
26 //-------------------------------------------------------------------------------------------------
27 #ifndef INTFUNC_H_INCLUDED
28 #define INTFUNC_H_INCLUDED
29
30 #ifdef MODULE_INTFUNC
31 #define DECMOD_INTFUNC
32 #else
33 #define DECMOD_INTFUNC extern
34 #endif
35
36 //Max and min of two integers.
37 DECMOD_INTFUNC int INTFUNC_max(int a, int b);
38 DECMOD_INTFUNC int INTFUNC_min(int a, int b);
39
40 //Odd and even..
41 DECMOD_INTFUNC int INTFUNC_is_even(int arg);
42 DECMOD_INTFUNC int INTFUNC_is_odd(int arg);
43
44 //Power residue 16807 functions.
45 //
46 //Makes the recurrence mapping for the power residue random
47 //number generator given by \alpha=16,807 and N=2^{31}-1.
48 //One fact that may not be apparent is that with a non-zero
49 //seed, the seed can't go to zero. This is because
50 //2^{31}-1 is a Mersenne prime, and so multiplying a number
51 //less than 2^{31}-1 by 16,807=7^3 can't result in a multiple
52 //of 2^{31}-1, by the fundamental theorem of arithmetic.
53 DECMOD_INTFUNC
54 unsigned int INTFUNC_rn_power_res_16807_mapping(unsigned int arg_in);
55
56 //Version control reporting functions.
57 DECMOD_INTFUNC const char *INTFUNC_cvcinfo(void);
58 DECMOD_INTFUNC const char *INTFUNC_hvcinfo(void);
59 #define INTFUNC_H_VERSION ("$Header$")
60 #endif
61
62 //End of intfunc.h.

Properties

Name Value
svn:keywords Header

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25