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

Function decFloatFromWider

extern/decNumber/decCommon.c:1022–1045  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1020// narrow-to is not possible for decQuad format numbers; simply omit
1021#if !QUAD
1022decFloat * decFloatFromWider(decFloat *result, const decFloatWider *wider,
1023 decContext *set) {
1024 bcdnum num; // collects data for finishing
1025 uByte bcdar[DECWPMAX]; // room for wider coefficient
1026 uInt widerhi=DFWWORD(wider, 0); // top word
1027 Int exp;
1028
1029 GETWCOEFF(wider, bcdar);
1030
1031 num.msd=bcdar; // MSD is here always
1032 num.lsd=bcdar+DECWPMAX-1; // LSD is here always
1033 num.sign=widerhi&0x80000000; // extract sign [DECFLOAT_Sign=Neg]
1034
1035 // decode the wider combination field to exponent
1036 exp=DECCOMBWEXP[widerhi>>26]; // decode from wider combination field
1037 // if it is a special there's nothing to do unless sNaN; if it's
1038 // finite then add the (wider) exponent continuation and unbias
1039 if (EXPISSPECIAL(exp)) exp=widerhi&0x7e000000; // include sNaN selector
1040 else exp+=GETWECON(wider)-DECWBIAS;
1041 num.exponent=exp;
1042
1043 // decShowNum(&num, "dffw");
1044 return decFinalize(result, &num, set);// round, check, and lay out
1045 } // decFloatFromWider
1046#endif
1047
1048/* ------------------------------------------------------------------ */

Callers

nothing calls this directly

Calls 1

decFinalizeFunction · 0.70

Tested by

no test coverage detected