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

Function decFloatXor

extern/decNumber/decBasic.c:3528–3546  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatXor -- logical digitwise XOR of two decFloats */ / result gets the result of XORing dfl and dfr */ dfl is the first decFloat (lhs) */ dfr is the second decFloat (rhs) */ set is the context

Source from the content-addressed store, hash-verified

3526/* comprise just zeros and ones; if not, Invalid operation results. */
3527/* ------------------------------------------------------------------ */
3528decFloat * decFloatXor(decFloat *result,
3529 const decFloat *dfl, const decFloat *dfr,
3530 decContext *set) {
3531 if (!DFISUINT01(dfl) || !DFISUINT01(dfr)
3532 || !DFISCC01(dfl) || !DFISCC01(dfr)) return decInvalid(result, set);
3533 // the operands are positive finite integers (q=0) with just 0s and 1s
3534 #if DOUBLE
3535 DFWORD(result, 0)=ZEROWORD
3536 |((DFWORD(dfl, 0) ^ DFWORD(dfr, 0))&0x04009124);
3537 DFWORD(result, 1)=(DFWORD(dfl, 1) ^ DFWORD(dfr, 1))&0x49124491;
3538 #elif QUAD
3539 DFWORD(result, 0)=ZEROWORD
3540 |((DFWORD(dfl, 0) ^ DFWORD(dfr, 0))&0x04000912);
3541 DFWORD(result, 1)=(DFWORD(dfl, 1) ^ DFWORD(dfr, 1))&0x44912449;
3542 DFWORD(result, 2)=(DFWORD(dfl, 2) ^ DFWORD(dfr, 2))&0x12449124;
3543 DFWORD(result, 3)=(DFWORD(dfl, 3) ^ DFWORD(dfr, 3))&0x49124491;
3544 #endif
3545 return result;
3546 } // decFloatXor
3547
3548/* ------------------------------------------------------------------ */
3549/* decInvalid -- set Invalid_operation result */

Callers

nothing calls this directly

Calls 1

decInvalidFunction · 0.85

Tested by

no test coverage detected