If it works, it's an example of ugly code. Plenty of game code is ugly as sin, though.
[0] https://www.polygon.com/2020/1/13/21064100/vvvvvv-source-cod...
It's a bit of a strange thing; in my personal experience, after spending some real time with this type of constraints, it can be a bit painful to come back to "general software best practices". You become so aware of the performance implications of everything you do that all those things we do in the name of software quality can feel incredibly wasteful in terms of CPU and memory resources. One has to remind themselves that in 90% of cases that level of optimization is not warranted.