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

Function decFloatAnd

extern/decNumber/decBasic.c:1582–1600  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatAnd -- logical digitwise AND of two decFloats */ / result gets the result of ANDing 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

1580/* comprise just zeros and ones; if not, Invalid operation results. */
1581/* ------------------------------------------------------------------ */
1582decFloat * decFloatAnd(decFloat *result,
1583 const decFloat *dfl, const decFloat *dfr,
1584 decContext *set) {
1585 if (!DFISUINT01(dfl) || !DFISUINT01(dfr)
1586 || !DFISCC01(dfl) || !DFISCC01(dfr)) return decInvalid(result, set);
1587 // the operands are positive finite integers (q=0) with just 0s and 1s
1588 #if DOUBLE
1589 DFWORD(result, 0)=ZEROWORD
1590 |((DFWORD(dfl, 0) & DFWORD(dfr, 0))&0x04009124);
1591 DFWORD(result, 1)=(DFWORD(dfl, 1) & DFWORD(dfr, 1))&0x49124491;
1592 #elif QUAD
1593 DFWORD(result, 0)=ZEROWORD
1594 |((DFWORD(dfl, 0) & DFWORD(dfr, 0))&0x04000912);
1595 DFWORD(result, 1)=(DFWORD(dfl, 1) & DFWORD(dfr, 1))&0x44912449;
1596 DFWORD(result, 2)=(DFWORD(dfl, 2) & DFWORD(dfr, 2))&0x12449124;
1597 DFWORD(result, 3)=(DFWORD(dfl, 3) & DFWORD(dfr, 3))&0x49124491;
1598 #endif
1599 return result;
1600 } // decFloatAnd
1601
1602/* ------------------------------------------------------------------ */
1603/* decFloatCanonical -- copy a decFloat, making canonical */

Callers

nothing calls this directly

Calls 1

decInvalidFunction · 0.85

Tested by

no test coverage detected