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

Function decFloatOr

extern/decNumber/decBasic.c:2845–2863  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatOr -- logical digitwise OR of two decFloats */ / result gets the result of ORing 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

2843/* comprise just zeros and ones; if not, Invalid operation results. */
2844/* ------------------------------------------------------------------ */
2845decFloat * decFloatOr(decFloat *result,
2846 const decFloat *dfl, const decFloat *dfr,
2847 decContext *set) {
2848 if (!DFISUINT01(dfl) || !DFISUINT01(dfr)
2849 || !DFISCC01(dfl) || !DFISCC01(dfr)) return decInvalid(result, set);
2850 // the operands are positive finite integers (q=0) with just 0s and 1s
2851 #if DOUBLE
2852 DFWORD(result, 0)=ZEROWORD
2853 |((DFWORD(dfl, 0) | DFWORD(dfr, 0))&0x04009124);
2854 DFWORD(result, 1)=(DFWORD(dfl, 1) | DFWORD(dfr, 1))&0x49124491;
2855 #elif QUAD
2856 DFWORD(result, 0)=ZEROWORD
2857 |((DFWORD(dfl, 0) | DFWORD(dfr, 0))&0x04000912);
2858 DFWORD(result, 1)=(DFWORD(dfl, 1) | DFWORD(dfr, 1))&0x44912449;
2859 DFWORD(result, 2)=(DFWORD(dfl, 2) | DFWORD(dfr, 2))&0x12449124;
2860 DFWORD(result, 3)=(DFWORD(dfl, 3) | DFWORD(dfr, 3))&0x49124491;
2861 #endif
2862 return result;
2863 } // decFloatOr
2864
2865/* ------------------------------------------------------------------ */
2866/* decFloatPlus -- add value to 0, heeding NaNs, etc. */

Callers

nothing calls this directly

Calls 1

decInvalidFunction · 0.85

Tested by

no test coverage detected