Small code changes to get the gcc-12 undefined sanitizer happy
Fixes #811 (closed).
I had to do some weird gymnastics in the cosmology module to get the sanitiser happy with writing to the buffer.
Similarly, I am not sure why the compiler is happy with the expression in cell_convert_part.c
but not with the original one.