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

Function decFloatCopySign

extern/decNumber/decBasic.c:1862–1869  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFloatCopySign -- copy a decFloat with the sign of another */ / result gets the result of copying dfl with the sign of dfr */ dfl is the first decFloat (lhs) */ dfr is the second decFloat (rhs) */ returns result

Source from the content-addressed store, hash-verified

1860/* This is a bitwise operation; no errors or exceptions are possible. */
1861/* ------------------------------------------------------------------ */
1862decFloat * decFloatCopySign(decFloat *result,
1863 const decFloat *dfl, const decFloat *dfr) {
1864 uByte sign=(uByte)(DFBYTE(dfr, 0)&0x80); // save sign bit
1865 if (dfl!=result) *result=*dfl; // copy needed
1866 DFBYTE(result, 0)&=~0x80; // clear sign ..
1867 DFBYTE(result, 0)=(uByte)(DFBYTE(result, 0)|sign); // .. and set saved
1868 return result;
1869 } // decFloatCopySign
1870
1871/* ------------------------------------------------------------------ */
1872/* decFloatDigits -- return the number of digits in a decFloat */

Callers 2

decDivideFunction · 0.85
decFloatNextTowardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected