mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
memory: inline and optimize devend_memop
devend_memop can rely on the fact that the result is always either 0 or MO_BSWAP, corresponding respectively to host endianness and the opposite. Native (target) endianness in turn can be either the host endianness, in which case MO_BSWAP is only returned for host-opposite endianness, or the opposite, in which case 0 is only returned for host endianness. With this in mind, devend_memop can be compiled as a setcond+shift for every target. Do this and, while at it, move it to include/exec/memory.h since !NEED_CPU_H files do not (and should not) need it. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
72d41eb4b8
commit
7a3df11c2a
2 changed files with 18 additions and 19 deletions
18
memory.c
18
memory.c
|
@ -3267,21 +3267,3 @@ static void memory_register_types(void)
|
|||
}
|
||||
|
||||
type_init(memory_register_types)
|
||||
|
||||
MemOp devend_memop(enum device_endian end)
|
||||
{
|
||||
static MemOp conv[] = {
|
||||
[DEVICE_LITTLE_ENDIAN] = MO_LE,
|
||||
[DEVICE_BIG_ENDIAN] = MO_BE,
|
||||
[DEVICE_NATIVE_ENDIAN] = MO_TE,
|
||||
[DEVICE_HOST_ENDIAN] = 0,
|
||||
};
|
||||
switch (end) {
|
||||
case DEVICE_LITTLE_ENDIAN:
|
||||
case DEVICE_BIG_ENDIAN:
|
||||
case DEVICE_NATIVE_ENDIAN:
|
||||
return conv[end];
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue