dreamcast/example/fipr.cpp
2025-01-26 03:04:42 -06:00

54 lines
763 B
C++

#include "stdint.h"
#include "sh7091/serial.hpp"
extern "C" float fipr(float * a, float * b);
extern "C" float sobel_y(float * a, uint32_t * i);
void test1()
{
float a[] = {1, 2, 3, 4};
float b[] = {5, 6, 7, 8};
// 70
union {
float f;
uint32_t i;
} v;
v.f = fipr(a, b);
serial::integer(v.i);
}
void test2()
{
float a[640 * 2];
a[0] = 11;
a[1] = 12;
a[2] = 13;
a[0 + 640] = 1400;
a[1 + 640] = 1500;
a[2 + 640] = 1600;
union {
float f;
uint32_t i;
} v;
v.f = sobel_y(a);
// 5952
serial::integer<uint32_t>(v.i);
}
void main()
{
serial::string("test1:\n");
test1();
serial::string("test2:\n");
test2();
serial::string("return\n");
serial::string("return\n");
serial::string("return\n");
}