
/******************************************************************************
  Example #6 -- Display selected two's complement values
******************************************************************************/

#include <stdio.h>
#include <limits.h>
#include "/user/cse320/lib/bitlib.h"

/*-----------------------------------------------------------------------------
   Name:  main

   Purpose:   Display the internal representation of selected integer values

   Receives:  Nothing
   Returns:   Exit status of zero

   Inputs:    Nothing
   Outputs:   Base 10, base 16 and base 2 representation of selected values
-----------------------------------------------------------------------------*/

int main()
{
  int I;

  printf( "\n" );
  printf( "  %+11d  %8.8x  %32s\n", INT_MAX,   INT_MAX,   bit32( INT_MAX ) );
  printf( "  %+11d  %8.8x  %32s\n", INT_MAX-1, INT_MAX-1, bit32( INT_MAX-1 ) );
  printf( "\n" );

  for (I=25; I>=-25; I--)
  {
    printf( "  %+11d  %8.8x  %32s\n", I, I, bit32( I ) );
  }

  printf( "\n" );
  printf( "  %+11d  %8.8x  %32s\n", INT_MIN+2, INT_MIN+2, bit32( INT_MIN+2 ) );
  printf( "  %+11d  %8.8x  %32s\n", INT_MIN+1, INT_MIN+1, bit32( INT_MIN+1 ) );
  printf( "  %+11d  %8.8x  %32s\n", INT_MIN,   INT_MIN,   bit32( INT_MIN ) );
  printf( "\n" );

  return 0;
}


