Line data Source code
1 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3 : !!!! !!!!
4 : !!!! ParaMonte: Parallel Monte Carlo and Machine Learning Library. !!!!
5 : !!!! !!!!
6 : !!!! Copyright (C) 2012-present, The Computational Data Science Lab !!!!
7 : !!!! !!!!
8 : !!!! This file is part of the ParaMonte library. !!!!
9 : !!!! !!!!
10 : !!!! LICENSE !!!!
11 : !!!! !!!!
12 : !!!! https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md !!!!
13 : !!!! !!!!
14 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16 :
17 : !> \brief
18 : !> This include file contains implementations of the procedures in module [pm_mathUnsigned](@ref pm_mathUnsigned).
19 : !>
20 : !> \finmain
21 : !>
22 : !> \author
23 : !> \FatemehBagheri, Sunday 11:23 PM, September 19, 2021, Dallas, TX
24 :
25 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 :
27 : #if uadd_ENABLED && IK_ENABLED
28 : integer(IKC) :: aa, bb
29 : integer(IKC), parameter :: HUGE_IKC = huge(0_IKC) !, SIGNBITLOC = bit_size(a) - 1_IKC
30 8 : CHECK_ASSERTION(__LINE__, 0_IKC <= a, SK_"@getFactoring(): The condition `0 <= a` must hold for corresponding input arguments. a = "//getStr(a))
31 8 : CHECK_ASSERTION(__LINE__, 0_IKC <= b, SK_"@getFactoring(): The condition `0 <= b` must hold for corresponding input arguments. b = "//getStr(b))
32 8 : if (HUGE_IKC - a < b) then ! overflowed.
33 : !aa = ibset(a, SIGNBITLOC)
34 : !bb = ibset(b, SIGNBITLOC)
35 6 : aa = a - HUGE_IKC - 1_IKC
36 6 : bb = b - HUGE_IKC - 1_IKC
37 6 : sum = aa + bb
38 : else
39 2 : sum = a + b
40 : end if
41 : #else
42 : #error "Unrecognized interface."
43 : #endif
|