// ********************************************************************** // BaseConv.h // // Definitions of functions for converting between base2 and base10. // // ********************************************************************** // CS251 - Computer Organization // Spring 1997 // Dickinson College // Grant Braught // // ********************************************************************** // #ifndef BASECONV #define BASECONV #include "Logic.h" DecValue ToBase10(BitString Base2Value, Bool Signed=FALSE); // Convert the base2 representation of a number passed in the // parameter Base2Value to base10. Return the result. // You need to be sure to accouunt for negative numbers // represented in twos complement format if Signed is TRUE. void ToBase2(DecValue Base10Value, BitString Base2Value, int NumBits, Bool Signed=FALSE); // Convert the base10 representation of the number passed in the // parameter Base10Value to base2. Put the result in Base2Value. // Again be sure to represent any negative numbers using twos // complement format if Signed is TRUE. // Remember all bit strings must be null terminated. void TwosComp(BitString Base2Value); // Take the twos complement of the base2 number that is passed in the // parameter Base2Value. The Twos complement of the number should // overwrite the current value. // This is simply changing the sign of the number. #endif