mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 04:28:49 +03:00
Add math defines for windows
This commit is contained in:
parent
139e7e2978
commit
5bafc77ece
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "blurhash.hpp"
|
#include "blurhash.hpp"
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -337,7 +338,7 @@ encode(unsigned char *image, size_t width, size_t height, int components_x, int
|
||||||
}
|
}
|
||||||
|
|
||||||
int quantisedMaximumValue = encodeMaxAC(actualMaximumValue);
|
int quantisedMaximumValue = encodeMaxAC(actualMaximumValue);
|
||||||
maximumValue = ((float)quantisedMaximumValue + 1) / 166;
|
maximumValue = ((float)quantisedMaximumValue + 1) / 166;
|
||||||
h += leftPad(encode83(quantisedMaximumValue), 1);
|
h += leftPad(encode83(quantisedMaximumValue), 1);
|
||||||
} else {
|
} else {
|
||||||
maximumValue = 1;
|
maximumValue = 1;
|
||||||
|
@ -399,7 +400,7 @@ TEST_CASE("AC")
|
||||||
{
|
{
|
||||||
auto h = "00%#MwS|WCWEM{R*bbWBbH"sv;
|
auto h = "00%#MwS|WCWEM{R*bbWBbH"sv;
|
||||||
for (size_t i = 0; i < h.size(); i += 2) {
|
for (size_t i = 0; i < h.size(); i += 2) {
|
||||||
auto s = h.substr(i, 2);
|
auto s = h.substr(i, 2);
|
||||||
const auto maxAC = 0.289157f;
|
const auto maxAC = 0.289157f;
|
||||||
CHECK(leftPad(encode83(encodeAC(decodeAC(decode83(s), maxAC), maxAC)), 2) == s);
|
CHECK(leftPad(encode83(encodeAC(decodeAC(decode83(s), maxAC), maxAC)), 2) == s);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue