1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:27:45 +00:00

Everywhere: Use AK/Math.h if applicable

AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.

Also clean up some stale math includes and improper floatingpoint usage.
This commit is contained in:
Hendiadyoin1 2021-07-17 18:29:28 +02:00 committed by Ali Mohammad Pur
parent c5f6ba6e71
commit ed46d52252
40 changed files with 116 additions and 156 deletions

View file

@ -10,12 +10,12 @@
#include <AK/Debug.h>
#include <AK/FlyString.h>
#include <AK/Format.h>
#include <AK/Math.h>
#include <AK/Stream.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCore/File.h>
#include <LibCore/FileStream.h>
#include <math.h>
namespace Audio {
@ -417,9 +417,9 @@ u32 FlacLoaderPlugin::convert_sample_count_code(u8 sample_count_code)
return FLAC_BLOCKSIZE_AT_END_OF_HEADER_16;
}
if (sample_count_code >= 2 && sample_count_code <= 5) {
return 576 * pow(2, (sample_count_code - 2));
return 576 * AK::exp2(sample_count_code - 2);
}
return 256 * pow(2, (sample_count_code - 8));
return 256 * AK::exp2(sample_count_code - 8);
}
u32 FlacLoaderPlugin::convert_sample_rate_code(u8 sample_rate_code)
@ -797,7 +797,7 @@ u64 read_utf8_char(InputStream& input)
while (((start_byte << length) & 0b10000000) == 0b10000000)
++length;
u8 bits_from_start_byte = 8 - (length + 1);
u8 start_byte_bitmask = pow(2, bits_from_start_byte) - 1;
u8 start_byte_bitmask = AK::exp2(bits_from_start_byte) - 1;
character = start_byte_bitmask & start_byte;
for (u8 i = length; i > 0; --i) {
input.read(single_byte_buffer);