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

Function decFloatInvert

extern/decNumber/decBasic.c:2339–2355  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatInvert -- logical digitwise INVERT of a decFloat */ / result gets the result of INVERTing df */ df is the decFloat to invert */ set is the context */ returns result, which will be canonical with sign=0

Source from the content-addressed store, hash-verified

2337/* comprise just zeros and ones; if not, Invalid operation results. */
2338/* ------------------------------------------------------------------ */
2339decFloat * decFloatInvert(decFloat *result, const decFloat *df,
2340 decContext *set) {
2341 uInt sourhi=DFWORD(df, 0); // top word of dfs
2342
2343 if (!DFISUINT01(df) || !DFISCC01(df)) return decInvalid(result, set);
2344 // the operand is a finite integer (q=0)
2345 #if DOUBLE
2346 DFWORD(result, 0)=ZEROWORD|((~sourhi)&0x04009124);
2347 DFWORD(result, 1)=(~DFWORD(df, 1)) &0x49124491;
2348 #elif QUAD
2349 DFWORD(result, 0)=ZEROWORD|((~sourhi)&0x04000912);
2350 DFWORD(result, 1)=(~DFWORD(df, 1)) &0x44912449;
2351 DFWORD(result, 2)=(~DFWORD(df, 2)) &0x12449124;
2352 DFWORD(result, 3)=(~DFWORD(df, 3)) &0x49124491;
2353 #endif
2354 return result;
2355 } // decFloatInvert
2356
2357/* ------------------------------------------------------------------ */
2358/* decFloatIs -- decFloat tests (IsSigned, etc.) */

Callers

nothing calls this directly

Calls 1

decInvalidFunction · 0.85

Tested by

no test coverage detected