Lab 3/uno32tests/u32helpers.c
static void num32asc( char * s, int n, int sz ) 
{
  int i;
  int bits;
  if( sz == 4 ) bits = 28;
  else if( sz == 2 ) bits = 12;
  else if( sz == 1 ) bits = 4;
  else bits = 0;
  if( bits )
    for( i = bits; i >= 0; i -= 4 )
      *s++ = "0123456789ABCDEF"[ (n >> i) & 15 ];
  else
    for( i = 0; i < 8; i += 1 )
      *s++ = "bad size"[ i ];
}
/* Helper function, local to this file.
   Converts a number to hexadecimal ASCII digits. */
Helper function, local to this file.
Converts a number to hexadecimal ASCII digits.
Helper function local to this file . Converts a number to hexadecimal ASCII digits .
static void num32asc( char * s, int n, int sz ) 
{
  int i;
  int bits;
  if( sz == 4 ) bits = 28;
  else if( sz == 2 ) bits = 12;
  else if( sz == 1 ) bits = 4;
  else bits = 0;
  if( bits )
    for( i = bits; i >= 0; i -= 4 )
      *s++ = "0123456789ABCDEF"[ (n >> i) & 15 ];
  else
    for( i = 0; i < 8; i += 1 )
      *s++ = "bad size"[ i ];
}
static void num32asc ( char * s , int n , int sz ) { int i ; int bits ; if ( sz == 4 ) bits = 28 ; else if ( sz == 2 ) bits = 12 ; else if ( sz == 1 ) bits = 4 ; else bits = 0 ; if ( bits ) for ( i = bits ; i >= 0 ; i -= 4 ) * s ++ = " " [ ( n >> i ) & 15 ] ; else for ( i = 0 ; i < 8 ; i += 1 ) * s ++ = " " [ i ] ; }
Helper function, local to this file.
Helper function local to this file .