From 1fff37e7b9b63e5e62e9d9d0eb4535636f7f2fe8 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Thu, 13 Feb 2025 16:41:08 +0100 Subject: Add ex01 --- ex01/Fixed.hpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 ex01/Fixed.hpp (limited to 'ex01/Fixed.hpp') diff --git a/ex01/Fixed.hpp b/ex01/Fixed.hpp new file mode 100644 index 0000000..cb2878e --- /dev/null +++ b/ex01/Fixed.hpp @@ -0,0 +1,40 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Fixed.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dkaiser + +class Fixed +{ + public: + Fixed(void); + Fixed(const int i); + Fixed(const float f); + Fixed(const Fixed &other); + Fixed &operator=(const Fixed &other); + ~Fixed(void); + + int getRawBits(void) const; + void setRawBits(int const raw); + int toInt(void) const; + float toFloat(void) const; + + private: + static const int fractional_bits = 8; + int raw_value; +}; + +std::ostream &operator<<(std::ostream &os, const Fixed &fixed); + +#endif -- cgit v1.2.3