format squiggle.c

This commit is contained in:
NunoSempere 2023-07-16 22:59:47 +02:00
parent 6247fbfb7b
commit bebb7c6d46

View File

@ -10,11 +10,9 @@
#define EXIT_ON_ERROR 0
#define PROCESS_ERROR(error_msg) process_error(error_msg, EXIT_ON_ERROR, __FILE__, __LINE__)
// PI constant
const float PI = 3.14159265358979323846; // M_PI in gcc gnu99
// Pseudo Random number generator
uint32_t xorshift32(uint32_t* seed)
{
// Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs"
@ -30,7 +28,6 @@ uint32_t xorshift32(uint32_t* seed)
}
// Distribution & sampling functions
float rand_0_to_1(uint32_t* seed)
{
return ((float)xorshift32(seed)) / ((float)UINT32_MAX);
@ -128,7 +125,8 @@ struct box {
char* error_msg;
};
struct box process_error(const char* error_msg, int should_exit, char* file, int line){
struct box process_error(const char* error_msg, int should_exit, char* file, int line)
{
if (should_exit) {
printf("@, in %s (%d)", file, line);
exit(1);