Fixed.class.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* Fixed.class.hpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@gmail.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/07/16 15:46:39 by bchanot #+# #+# */
  9. /* Updated: 2025/07/17 17:16:03 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #ifndef FIXED_CLASS_H
  13. # define FIXED_CLASS_H
  14. #include <iostream>
  15. class Fixed {
  16. public:
  17. Fixed(void);
  18. Fixed(Fixed const &src);
  19. Fixed(int const num);
  20. Fixed(float const num);
  21. ~Fixed(void);
  22. int getRawBits(void) const;
  23. void setRawBits(int const raw);
  24. float toFloat(void) const;
  25. int toInt(void) const;
  26. Fixed &operator=(Fixed const &rhs);
  27. private:
  28. int _value;
  29. static int const _frac = 8;
  30. };
  31. std::ostream &operator<<(std::ostream &o, Fixed const &i);
  32. #endif