better formatting

This commit is contained in:
Alessandro Mauri 2024-10-23 00:00:04 +02:00
parent 16226f81a7
commit 09cb13b7e9

View file

@ -20,23 +20,11 @@ const int MAX_LUMINANCE = 700;
// minimum display brightness in percent
const float MIN_BRIGHTNESS_PERCENT = 0.05;
macro abs(x)
{
if (x < 0) {
return -x;
} else {
return x;
}
}
macro abs(x) { return x < 0 ? -x : x; }
macro clamp(x, l, h) { return max(min(x, h), l); }
// l <= x <= h
macro clamp(x, l, h)
{
return max(min(x, h), l);
}
// read a string to the buffer up until the end of the buffer or the first '\n'
/**
* read a string to the buffer up until the end of the buffer or the first '\n'
* @require fp != null
**/
fn void! io::File.gets(&self, char[] buffer)
@ -57,9 +45,9 @@ fn void! io::File.gets(&self, char[] buffer)
buffer[i] = '\0';
}
// read a string from a file and convert it to int, should only be used for
// positive numbers since negative numbers mean an error
/**
* read a string from a file and convert it to int, should only be used for
* positive numbers since negative numbers mean an error
* @ensure return > 0, return < 1000000
**/
fn int! read_int(String path)
@ -85,10 +73,7 @@ fn void! write_int(String path, int value)
}
// returns the luminance value in percentage between 0 and 1
macro get_luminance_raw()
{
return read_int(LUMINANCE_DEV);
}
macro get_luminance_raw() { return read_int(LUMINANCE_DEV); }
fn float bezier(float t)
{