Fix compile error on Numworks calculators

This commit is contained in:
Heath123
2023-05-06 15:57:35 +01:00
parent 7ec9c63067
commit d3f534ef95
4 changed files with 8 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
#include "display.h"
#include "framebuffer.h"
#include <kandinsky/color.h>
#include <cstdint>
#include <stdint.h>
#include <gint/display-cg.h>
#include <ion/display.h>
#include <string.h>

View File

@@ -1,8 +1,8 @@
#ifndef KANDINSKY_POSTPROCESS_GAMMA_CONTEXT_H
#define KANDINSKY_POSTPROCESS_GAMMA_CONTEXT_H
#include <cstdint>
#include <kandinsky/postprocess_context.h>
#include <stdint.h>
class KDPostProcessGammaContext : public KDPostProcessContext {
public:

View File

@@ -1,9 +1,8 @@
#include <kandinsky/color.h>
#include <cstdint>
#include <kandinsky/postprocess_gamma_context.h>
#include <ion.h>
#include <math.h>
#include <stdio.h>
#include <stdint.h>
constexpr int MaxGammaStates = 7;
constexpr float MaxGammaGamut = 0.75;

View File

@@ -2,9 +2,9 @@
#define POINCARE_IEEE754_H
#include <assert.h>
#include <cstdint>
#include <stdint.h>
#include <stddef.h>
#include <stdint.h>
#include <cmath>
#include <type_traits>
@@ -43,27 +43,18 @@ public:
if (((uint64_t)mantissa >> (size()-k_mantissaNbBits-2)) & 1) {
u.ui += 1;
}
// Return f32.f or f64.f depending on the type of T
// Copilot did this so I don't really understand it
if constexpr (std::is_same<T, float>::value) {
if (sizeof(T) == sizeof(float)) {
return u.f32.f;
} else if constexpr (std::is_same<T, double>::value) {
return u.f64.f;
} else {
// Error and log the type at compile time
static_assert(std::is_same<T, float>::value || std::is_same<T, double>::value, "IEEE754::buildFloat: T must be float or double");
return u.f64.f;
}
}
static int exponent(T f) {
uint_float u;
// u.f = f;
if constexpr (std::is_same<T, float>::value) {
if (sizeof(T) == sizeof(float)) {
u.f32.f = f;
} else if constexpr (std::is_same<T, double>::value) {
u.f64.f = f;
} else {
// Error and log the type at compile time
static_assert(std::is_same<T, float>::value || std::is_same<T, double>::value, "IEEE754::exponent: T must be float or double");
u.f64.f = f;
}
constexpr uint16_t oneOnExponentsBits = maxExponent();
int exp = (u.ui >> k_mantissaNbBits) & oneOnExponentsBits;