MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ChangeSign

Method ChangeSign

extern/ttmath/ttmathint.h:105–127  ·  view source on GitHub ↗

! we change the sign of the value if it isn't possible to change the sign this method returns 1 else return 0 and changing the sign */

Source from the content-addressed store, hash-verified

103 else return 0 and changing the sign
104 */
105 uint ChangeSign()
106 {
107 /*
108 if the value is equal that one which has been returned from SetMin
109 (only the highest bit is set) that means we can't change sign
110 because the value is too big (bigger about one)
111
112 e.g. when value_size = 1 and value is -2147483648 we can't change it to the
113 2147483648 because the max value which can be held is 2147483647
114
115 we don't change the value and we're using this fact somewhere in some methods
116 (if we look on our value without the sign we get the correct value
117 eg. -2147483648 in Int<1> will be 2147483648 on the UInt<1> type)
118 */
119 if( UInt<value_size>::IsOnlyTheHighestBitSet() )
120 return 1;
121
122 UInt<value_size> temp(*this);
123 UInt<value_size>::SetZero();
124 UInt<value_size>::Sub(temp);
125
126 return 0;
127 }
128
129
130

Callers 10

PrepareSinFunction · 0.80
SinFunction · 0.80
ASinFunction · 0.80
ATanFunction · 0.80
DegToDegFunction · 0.80
SetBernoulliNumbersFunction · 0.80
PowMethod · 0.80
operator-Method · 0.80
setMethod · 0.80
negMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected