diff --git a/src/libCom/cvtFast.c b/src/libCom/cvtFast.c index 2106990bc..9d5bb2abf 100644 --- a/src/libCom/cvtFast.c +++ b/src/libCom/cvtFast.c @@ -41,7 +41,9 @@ * cvt[Float/Double]ToCompactString, * cvtLongToHex, cvtLongToOctal routines, fix * calls to gcvt, etc. + * .03 joh 03-30-93 added bit field extract/ insert routines */ + #include #include /* XPG2/XPG3/POSIX.1/FIPS151-1/ANSI-C */ #include @@ -751,3 +753,54 @@ int cvtLongToOctalString( *pdest = 0; return((int)(pdest-startAddr)); } + + + + +/* + * + * cvtBitsToUlong() + * + * extract a bit field from the source unsigend long + */ +unsigned long cvtBitsToUlong( +unsigned long src, +unsigned bitFieldOffset, +unsigned bitFieldLength) +{ + unsigned long mask; + + src = src >> bitFieldOffset; + + mask = (1< #include /* XPG2/XPG3/POSIX.1/FIPS151-1/ANSI-C */ #include @@ -751,3 +753,54 @@ int cvtLongToOctalString( *pdest = 0; return((int)(pdest-startAddr)); } + + + + +/* + * + * cvtBitsToUlong() + * + * extract a bit field from the source unsigend long + */ +unsigned long cvtBitsToUlong( +unsigned long src, +unsigned bitFieldOffset, +unsigned bitFieldLength) +{ + unsigned long mask; + + src = src >> bitFieldOffset; + + mask = (1<