check leaks on d02 ok
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
* statics variables initialisation
|
||||
*
|
||||
* for MAX integer :
|
||||
* 00000000 01111111 11111111 11111111 ( 8388607) (-1U >> (this->_frac +1))
|
||||
* 00000000 01111111 11111111 11111111 ( 8388607) (-1U >> (this->_frac + 1))
|
||||
* <= ... >=
|
||||
* 11111111 10000000 00000000 00000000 (-8388608) ~MAX
|
||||
*
|
||||
*/
|
||||
|
||||
int const Fixed::_frac = 8;
|
||||
int const Fixed::_max = -1U >> (_frac +1);
|
||||
int const Fixed::_max = -1U >> (_frac + 1);
|
||||
int const Fixed::_min = ~_max;
|
||||
|
||||
/*
|
||||
@@ -55,6 +55,18 @@ Fixed::Fixed(float const floater) {
|
||||
std::cout << "error: float out of range" << '\n';
|
||||
else
|
||||
this->_value = roundf(floater * (1 << Fixed::_frac));
|
||||
|
||||
// this->_value = *((int *)&floater); // access float adress content as int
|
||||
// int sign = this->_value & (1 << 31); // extract sign
|
||||
// int exponent = ((unsigned int)(this->_value << 1) >> 24) - 127; // extract exponent
|
||||
// int integer = (this->_value << 8) | (1 << 31); // add left 1
|
||||
// integer = (unsigned int)integer >> (31 - this->_frac - exponent);// align to right
|
||||
// if (sign != 0)
|
||||
// integer = (~integer + 1); // reverse negatif
|
||||
// integer = (integer << (30 - this->_frac - exponent)) | sign; // add sign
|
||||
// integer >>= (30 - this->_frac - exponent); // align right
|
||||
// std::cout << "integer : " << printBitsInt(integer) << " (" << integer << ")\n";
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user