diff options
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index d484746..83fd258 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3877,6 +3877,31 @@ value_literal_complex (struct value *arg1, return val; } +/* See value.h. */ + +struct value * +value_real_part (struct value *value) +{ + struct type *type = check_typedef (value_type (value)); + struct type *ttype = TYPE_TARGET_TYPE (type); + + gdb_assert (TYPE_CODE (type) == TYPE_CODE_COMPLEX); + return value_from_component (value, ttype, 0); +} + +/* See value.h. */ + +struct value * +value_imaginary_part (struct value *value) +{ + struct type *type = check_typedef (value_type (value)); + struct type *ttype = TYPE_TARGET_TYPE (type); + + gdb_assert (TYPE_CODE (type) == TYPE_CODE_COMPLEX); + return value_from_component (value, ttype, + TYPE_LENGTH (check_typedef (ttype))); +} + /* Cast a value into the appropriate complex data type. */ static struct value * |