mirror of https://git.sr.ht/~kikoodx/momento
39 lines
489 B
C
39 lines
489 B
C
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
/* Copyright (C) 2021 KikooDX */
|
|
|
|
#include "util.h"
|
|
#include <gint/display.h>
|
|
|
|
float
|
|
square(float x)
|
|
{
|
|
return x * x;
|
|
}
|
|
|
|
float
|
|
isquare(float x)
|
|
{
|
|
return 1.0 - square(1.0 - x);
|
|
}
|
|
|
|
float
|
|
abs(float x)
|
|
{
|
|
return (x > 0) ? x : -x;
|
|
}
|
|
|
|
int
|
|
sign(float x)
|
|
{
|
|
return 1 * (x > 0) - 1 * (x < 0);
|
|
}
|
|
|
|
/* courtesy of Lephenixnoir */
|
|
void
|
|
darken_vram(void)
|
|
{
|
|
int i;
|
|
for (i = 0; i < DWIDTH * DHEIGHT; i++)
|
|
gint_vram[i] = (gint_vram[i] & 0xf7de) >> 1;
|
|
}
|