int and float constructor right print
This commit is contained in:
parent
4d3528ed3f
commit
1c500e28bf
@ -22,13 +22,13 @@ Fixed::Fixed(const Fixed& src)
|
||||
|
||||
Fixed::Fixed(const int& src)
|
||||
{
|
||||
std::cout << "Copy constructor called" << std::endl;
|
||||
std::cout << "Int constructor called" << std::endl;
|
||||
this->_value = src << this->_nb_bits;
|
||||
}
|
||||
|
||||
Fixed::Fixed(const float& src)
|
||||
{
|
||||
std::cout << "Copy constructor called" << std::endl;
|
||||
std::cout << "Float constructor called" << std::endl;
|
||||
this->_value = (int) roundf(src * (1 << this->_nb_bits));
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,13 @@ Fixed::Fixed(const Fixed& src)
|
||||
|
||||
Fixed::Fixed(const int& src)
|
||||
{
|
||||
std::cout << "Copy constructor called" << std::endl;
|
||||
std::cout << "Int constructor called" << std::endl;
|
||||
this->_value = src << this->_nb_bits;
|
||||
}
|
||||
|
||||
Fixed::Fixed(const float& src)
|
||||
{
|
||||
std::cout << "Copy constructor called" << std::endl;
|
||||
std::cout << "Float constructor called" << std::endl;
|
||||
this->_value = (int) roundf(src * (1 << this->_nb_bits));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user