InnoDB has its own inline functions to load/store integer values from/to memory. These
functions make conversion between a host byte order and the big-endian representation
because the InnoDB on-disk format is big-endian. Unfortunately, implementation of these
functions could be translated by compiler to not optimal assembler code.
The following Godbolt link https://godbolt.org/z/Bvm4hx shows how optimized and
not-optimized functions look like after compiler generated assembler code.
Moreover, implementation of mi_*() macros and inlined functions located in the file
include/myisampack.h and implementation of mach_read_from_, mach_write_to_ functions
from the file storage/innobase/include/mach0data.ic use direct manipulation with bytes array
to store/load integers in big-endian representation instead of isolating such a code in
standalone functions and calling them from functions mentioned above. That leads to code
duplication and code bloating in a server binary.
This bug report is to make optimization of source code for loading/storing integers in
big-endian format and to refactor source code for storing/loading integers in big-endian
format to avoid code duplication.