/*
 * DISTRHO Cardinal Plugin
 * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * For a full copy of the GNU General Public License see the LICENSE file.
 */

#pragma once
#include_next <algorithm>
#include_next <complex>

namespace std {

static inline
float max(const float a, const double b) {
    return std::max<float>(a, static_cast<float>(b));
}

static inline
float min(const float a, const double b) {
    return std::min<float>(a, static_cast<float>(b));
}

static inline
std::complex<float> operator*(const std::complex<double>& a, const float b) {
    return static_cast<std::complex<float>>(a) * b;
}

static inline
std::complex<float> operator*(const float a, const std::complex<double>& b) {
    return a * static_cast<std::complex<float>>(b);
}

static inline
std::complex<float> operator/(const std::complex<double>& a, const std::complex<float>& b) {
    return static_cast<std::complex<float>>(a) / b;
}

}
