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

Function decFloatDigits

extern/decNumber/decBasic.c:1891–1950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1889 return (DECPMAX-1-3*(n))-(3-DPD2BCD8[dpd*4+3])
1890
1891uInt decFloatDigits(const decFloat *df) {
1892 uInt dpd; // work
1893 uInt sourhi=DFWORD(df, 0); // top word from source decFloat
1894 #if QUAD
1895 uInt sourmh, sourml;
1896 #endif
1897 uInt sourlo;
1898
1899 if (DFISINF(df)) return 1;
1900 // A NaN effectively has an MSD of 0; otherwise if non-zero MSD
1901 // then the coefficient is full-length
1902 if (!DFISNAN(df) && DECCOMBMSD[sourhi>>26]) return DECPMAX;
1903
1904 #if DOUBLE
1905 if (sourhi&0x0003ffff) { // ends in first
1906 dpdlenchk(0, sourhi>>8);
1907 sourlo=DFWORD(df, 1);
1908 dpdlendun(1, (sourhi<<2) | (sourlo>>30));
1909 } // [cannot drop through]
1910 sourlo=DFWORD(df, 1); // sourhi not involved now
1911 if (sourlo&0xfff00000) { // in one of first two
1912 dpdlenchk(1, sourlo>>30); // very rare
1913 dpdlendun(2, sourlo>>20);
1914 } // [cannot drop through]
1915 dpdlenchk(3, sourlo>>10);
1916 dpdlendun(4, sourlo);
1917 // [cannot drop through]
1918
1919 #elif QUAD
1920 if (sourhi&0x00003fff) { // ends in first
1921 dpdlenchk(0, sourhi>>4);
1922 sourmh=DFWORD(df, 1);
1923 dpdlendun(1, ((sourhi)<<6) | (sourmh>>26));
1924 } // [cannot drop through]
1925 sourmh=DFWORD(df, 1);
1926 if (sourmh) {
1927 dpdlenchk(1, sourmh>>26);
1928 dpdlenchk(2, sourmh>>16);
1929 dpdlenchk(3, sourmh>>6);
1930 sourml=DFWORD(df, 2);
1931 dpdlendun(4, ((sourmh)<<4) | (sourml>>28));
1932 } // [cannot drop through]
1933 sourml=DFWORD(df, 2);
1934 if (sourml) {
1935 dpdlenchk(4, sourml>>28);
1936 dpdlenchk(5, sourml>>18);
1937 dpdlenchk(6, sourml>>8);
1938 sourlo=DFWORD(df, 3);
1939 dpdlendun(7, ((sourml)<<2) | (sourlo>>30));
1940 } // [cannot drop through]
1941 sourlo=DFWORD(df, 3);
1942 if (sourlo&0xfff00000) { // in one of first two
1943 dpdlenchk(7, sourlo>>30); // very rare
1944 dpdlendun(8, sourlo>>20);
1945 } // [cannot drop through]
1946 dpdlenchk(9, sourlo>>10);
1947 dpdlendun(10, sourlo);
1948 // [cannot drop through]

Callers 6

decFloatClassFunction · 0.85
decFloatIsNormalFunction · 0.85
decFloatLogBFunction · 0.85
decFloatRotateFunction · 0.85
decFloatScaleBFunction · 0.85
decFloatShiftFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected