int and float constructor right print
This commit is contained in:
		@ -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));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user