mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Add alias_value() function.
alias_value returns a new value where only the type is different, the bit-pattern of the value itself is untouched.
This commit is contained in:
parent
82ded2b638
commit
42ba0c9d54
2 changed files with 17 additions and 2 deletions
|
@ -54,8 +54,9 @@ struct ex_value_s *new_uinteger_val (int uinteger_val);
|
|||
struct ex_value_s *new_short_val (short short_val);
|
||||
struct ex_value_s *new_nil_val (struct type_s *type);
|
||||
|
||||
struct ex_value_s * convert_value (struct ex_value_s *value,
|
||||
struct type_s *type);
|
||||
struct ex_value_s *convert_value (struct ex_value_s *value,
|
||||
struct type_s *type);
|
||||
struct ex_value_s *alias_value (struct ex_value_s *value, struct type_s *type);
|
||||
struct def_s *emit_value (struct ex_value_s *value, struct def_s *def);
|
||||
|
||||
int ReuseString (const char *str);
|
||||
|
|
|
@ -397,6 +397,20 @@ convert_value (ex_value_t *value, type_t *type)
|
|||
}
|
||||
}
|
||||
|
||||
ex_value_t *
|
||||
alias_value (ex_value_t *value, type_t *type)
|
||||
{
|
||||
ex_value_t new;
|
||||
|
||||
if (type_size (type) != type_size (ev_types[value->type])) {
|
||||
error (0, "unable to alias different sized values");
|
||||
return value;
|
||||
}
|
||||
new = *value;
|
||||
new.type = type->type;
|
||||
return find_value (&new);
|
||||
}
|
||||
|
||||
static immediate_t *
|
||||
make_def_imm (def_t *def, hashtab_t *tab, ex_value_t *val)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue