1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:07:35 +00:00

AK/Hex: Cleanup implementation

Problem:
- Post-increment of loop index.
- `const` variables are not marked `const`.
- Incorrect type for loop index.

Solution:
- Pre-increment loop index.
- Mark all possible variables `const`.
- Corret type for loop index.
This commit is contained in:
Lenny Maiorani 2021-04-18 11:12:03 -06:00 committed by Andreas Kling
parent d462a56163
commit c1971df4c7
3 changed files with 50 additions and 50 deletions

View file

@ -316,11 +316,11 @@ static constexpr bool approx_eq(const Complex<T>& a, const Complex<U>& b, const
return x.magnitude() <= margin;
}
//complex version of exp()
// complex version of exp()
template<AK::Concepts::Arithmetic T>
static constexpr Complex<T> cexp(const Complex<T>& a)
{
//FIXME: this can probably be faster and not use so many expensive trigonometric functions
// FIXME: this can probably be faster and not use so many expensive trigonometric functions
if constexpr (sizeof(T) <= sizeof(float)) {
return expf(a.real()) * Complex<T>(cosf(a.imag()), sinf(a.imag()));
} else if constexpr (sizeof(T) <= sizeof(double)) {