mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
tcg: Introduce tcg_type_size
Add a helper function for computing the size of a type. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
89496a85b4
commit
31c9641746
2 changed files with 28 additions and 15 deletions
|
@ -319,6 +319,22 @@ typedef enum TCGType {
|
|||
#endif
|
||||
} TCGType;
|
||||
|
||||
/**
|
||||
* tcg_type_size
|
||||
* @t: type
|
||||
*
|
||||
* Return the size of the type in bytes.
|
||||
*/
|
||||
static inline int tcg_type_size(TCGType t)
|
||||
{
|
||||
unsigned i = t;
|
||||
if (i >= TCG_TYPE_V64) {
|
||||
tcg_debug_assert(i < TCG_TYPE_COUNT);
|
||||
i -= TCG_TYPE_V64 - 1;
|
||||
}
|
||||
return 4 << i;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_alignment_bits
|
||||
* @memop: MemOp value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue