-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFixed.hpp
41 lines (33 loc) · 1.37 KB
/
Fixed.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Fixed.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/12 18:27:05 by zelhajou #+# #+# */
/* Updated: 2024/06/12 18:44:17 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FIXED_HPP
# define FIXED_HPP
#include <iostream>
class Fixed
{
private:
int _fixedPointValue;
static const int _fractionalBits = 8;
public:
Fixed();
Fixed(const int intVal);
Fixed(const float floatVal);
Fixed(const Fixed &other);
Fixed &operator=(const Fixed &other);
~Fixed();
int getRawBits(void) const;
void setRawBits(int const raw);
float toFloat(void) const;
int toInt(void) const;
};
std::ostream &operator<<(std::ostream &out, const Fixed &fixed);
#endif