30 lines
480 B
C++
30 lines
480 B
C++
|
#ifndef FIXED_H
|
||
|
# define FIXED_H
|
||
|
|
||
|
# include <ostream>
|
||
|
|
||
|
class Fixed
|
||
|
{
|
||
|
private:
|
||
|
int _value;
|
||
|
static const int _nb_bits = 8;
|
||
|
|
||
|
public:
|
||
|
Fixed();
|
||
|
Fixed(const Fixed& src);
|
||
|
Fixed(const int &n);
|
||
|
Fixed(const float &f);
|
||
|
~Fixed();
|
||
|
|
||
|
Fixed &operator=(const Fixed& src);
|
||
|
|
||
|
int getRawBits( void ) const;
|
||
|
void setRawBits( int const raw );
|
||
|
float toFloat(void) const ;
|
||
|
int toInt(void) const ;
|
||
|
};
|
||
|
|
||
|
std::ostream& operator << (std::ostream &out, const Fixed& fixed);
|
||
|
|
||
|
#endif
|