@@ -451,11 +451,11 @@ class FixedPoint {
451451 * Pure FixedPoint sqrt implementation using Heron's Algorithm.
452452 *
453453 * Note that this function is undefined for negative values.
454- *
455- * There's a small loss in precision depending on the value of fractional_bits and the position of
456- * the most significant bit: if the integer portion is very large, we won't have as much (absolute)
457- * precision. Ideally you would want the intermediate_type to be twice the size of raw_type to avoid
458- * any losses.
454+ *
455+ * There's a small loss in precision depending on the value of fractional_bits and the position of
456+ * the most significant bit: if the integer portion is very large, we won't have as much (absolute)
457+ * precision. Ideally you would want the intermediate_type to be twice the size of raw_type to avoid
458+ * any losses.
459459 */
460460 constexpr FixedPoint sqrt () {
461461 // Zero can cause issues later, so deal with now.
@@ -464,16 +464,16 @@ class FixedPoint {
464464 }
465465
466466 // Check for negative values
467- ENSURE (std::is_unsigned<raw_type>() or std::is_signed<raw_type>() and this ->raw_value > 0 , " FixedPoint::sqrt() is undefined for negative values." );
467+ ENSURE (std::is_unsigned<raw_type>() or ( std::is_signed<raw_type>() and this ->raw_value > 0 ) , " FixedPoint::sqrt() is undefined for negative values." );
468468
469469 // A greater shift = more precision, but can overflow the intermediate type if too large.
470470 size_t max_shift = std::countl_zero (static_cast <unsigned_intermediate_type>(this ->raw_value )) - 1 ;
471471 size_t shift = max_shift > fractional_bits ? fractional_bits : max_shift;
472472
473- // shift + fractional bits must be an even number
474- if ((shift + fractional_bits) % 2 ) {
475- shift -= 1 ;
476- }
473+ // shift + fractional bits must be an even number
474+ if ((shift + fractional_bits) % 2 ) {
475+ shift -= 1 ;
476+ }
477477
478478 // We can't use the safe shift since the shift value is unknown at compile time.
479479 intermediate_type n = static_cast <intermediate_type>(this ->raw_value ) << shift;
@@ -484,8 +484,7 @@ class FixedPoint {
484484 guess = (guess + n / guess) / 2 ;
485485 if (guess == prev) {
486486 break ;
487-
488- }
487+ }
489488 }
490489
491490 // The sqrt operation halves the number of bits, so we'll we'll have to calculate a shift back
0 commit comments