Compare commits

..

10 Commits

Author SHA1 Message Date
7bdee8215f start writing code for decompressing chunk data.
I still haven't much of an idea where I'll take this, but it's a start.

I know it is needed for block filtering and such, I still need to find a
way how I'll actually implement it.
2025-09-09 16:30:40 +02:00
fb52517f06 rework error.h, to decrease impact on binary size.
We were statically creating a new string per log message, so re-using
the same message would cause duplicate byte sizes.
Now, all prefixes / suffixes are only defined once, the file name is
defined once per file, the line number should be defined once per unique
line.
This just saves some memory in the final binary, allowing things to be
optimised a little better.
2025-09-09 16:30:40 +02:00
63df7430b7 fix: shouldn't multiply by CHUNKS, but by SECTOR 2025-09-04 13:28:13 +02:00
527b1e2b16 change mvchunks parameter order, to be a bit more clear and consistent with functions such as memmove 2025-09-04 13:12:51 +02:00
08ab721622 fix: violating strict aliasing rules in most areas in the new code.
Yes, I am aware there are plenty of violations in `conf.c`, but I'll
likely fix/rewrite those when I will use it. Since there are some other
changes I think I'll want to make.
2025-09-04 13:12:51 +02:00
0baa1ac9e8 add a flag when debugging to generate SIGFPE when signed integer overflow occurs. (this is UB) 2025-09-04 12:54:00 +02:00
9cb0631df8 add comments to point at where strict aliasing rule violations occur in data scripts
this is definitely not all of them, a thorough rewrite must take place
to fix as many as we can.
2025-09-04 12:54:00 +02:00
008604ff5e delete redundant COLOUR32 definitions 2025-09-04 11:35:52 +02:00
56427673cb add quit in main.c to atexit, for added safety 2025-09-04 11:35:52 +02:00
93db7681eb write a portable version of endian.h, to replace the system's endian.h.
utilising GNU C standard library for some of the functionality, or GNU C
extensions.
2025-09-04 11:35:52 +02:00
2 changed files with 13 additions and 13 deletions

View File

@@ -16,19 +16,19 @@
#define htole16(x) (x)
#define htole32(x) (x)
#define htole64(x) (x)
#define be16toh(x) __bswap_16(x)
#define be32toh(x) __bswap_32(x)
#define be64toh(x) __bswap_64(x)
#define htobe16(x) __bswap_16(x)
#define htobe32(x) __bswap_32(x)
#define htobe64(x) __bswap_64(x)
#define be16toh(x) __bswap16(x)
#define be32toh(x) __bswap32(x)
#define be64toh(x) __bswap64(x)
#define htobe16(x) __bswap16(x)
#define htobe32(x) __bswap32(x)
#define htobe64(x) __bswap64(x)
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define le16toh(x) __bswap_16(x)
#define le32toh(x) __bswap_32(x)
#define le64toh(x) __bswap_64(x)
#define htole16(x) __bswap_16(x)
#define htole32(x) __bswap_32(x)
#define htole64(x) __bswap_64(x)
#define le16toh(x) __bswap16(x)
#define le32toh(x) __bswap32(x)
#define le64toh(x) __bswap64(x)
#define htole16(x) __bswap16(x)
#define htole32(x) __bswap32(x)
#define htole64(x) __bswap64(x)
#define be16toh(x) (x)
#define be32toh(x) (x)
#define be64toh(x) (x)

View File

@@ -51,7 +51,7 @@ PROF = rel
CFLAGS += -DNDEBUG -O2
endif
CFLAGS += $(shell pkg-config --cflags glfw3 libarchive) -Iinclude -Ilib/glad/include
CFLAGS += $(shell pkg-config --cflags glfw3 libarchive) -Ilib/include -Ilib/glad/include
LDFLAGS += $(shell pkg-config --libs glfw3 libarchive) -lm
# get source files