mvp_tips/CPUID/CPUID/FormatBinary.cpp
CString FormatBinary(UINT n, UINT w)
   {
    CString s;

    for(UINT i = 0; i < w; i++)
       { /* format bits */
        s = ((n & 1) ? _T("1") : _T("0")) + s;
        n >>= 1;
       } /* format bits */
    return s;
   }
/****************************************************************************
*                                FormatBinary
* Inputs:
*       UINT n: Value to format
*       UINT w: Width to format
* Result: CString
*       n formatted as binary to w bits
****************************************************************************/
FormatBinary
Inputs:
UINT n: Value to format
UINT w: Width to format
Result: CString
n formatted as binary to w bits
FormatBinary Inputs : UINT n : Value to format UINT w : Width to format Result : CString n formatted as binary to w bits
CString FormatBinary(UINT n, UINT w)
   {
    CString s;
    for(UINT i = 0; i < w; i++)
       { 
        s = ((n & 1) ? _T("1") : _T("0")) + s;
        n >>= 1;
       } 
    return s;
   }
CString FormatBinary ( UINT n , UINT w ) { CString s ; for ( UINT i = 0 ; i < w ; i ++ ) { s = ( ( n & 1 ) ? _T ( " " ) : _T ( " " ) ) + s ; n >>= 1 ; } return s ; }
FormatBinary
Inputs:
UINT n: Value to format
UINT w: Width to format
Result: CString
n formatted as binary to w bits
FormatBinary Inputs : UINT n : Value to format UINT w : Width to format Result : CString n formatted as binary to w bits
/* format bits */ /* format bits */