Always scan out all bits, but make sure only the allowed number of bytes
end up in the caller-provided buffer. Discard the rest by adding another
scan field when size < 4.
Rewrite the endianness callback to avoid reading outside allocated memory.
Make it directly usable as a callback without the need for a wrapper. Move
the shared callback to a more suitable home in arm7_9_common.
This fixes the regressions introduced in commits
Signed-off-by: Andreas Fritiofson <email@example.com>
Reviewed-by: Spencer Oliver <firstname.lastname@example.org>
Reviewed-by: Freddie Chopin <email@example.com>