34 lines
1.3 KiB
C++
34 lines
1.3 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* :::::::: */
|
|
/* Fixed.hpp :+: :+: */
|
|
/* +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
|
/* +#+ */
|
|
/* Created: 2025/03/24 15:22:48 by whaffman #+# #+# */
|
|
/* Updated: 2025/03/25 10:05:17 by whaffman ######## odam.nl */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
class Fixed {
|
|
public:
|
|
Fixed();
|
|
Fixed(const int value);
|
|
Fixed(const float value);
|
|
Fixed(const Fixed &fixed);
|
|
~Fixed();
|
|
|
|
Fixed &operator=(const Fixed &fixed);
|
|
|
|
int getRawBits(void) const;
|
|
void setRawBits(int const raw);
|
|
float toFloat(void) const;
|
|
int toInt(void) const;
|
|
|
|
|
|
private:
|
|
int fixedPointValue;
|
|
static const int fractionalBits = 8;
|
|
};
|
|
|
|
std::ostream &operator<<(std::ostream &out, const Fixed &fixed); |