From: Nick Clifton <nickc@redhat.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: binutils@sourceware.org, Claudiu.Zissulescu@synopsys.com,
Cupertino.Miranda@synopsys.com, noamca@mellanox.com
Subject: Re: [PATCHv2 1/3] opcodes/arc: Move instruction length logic to new function
Date: Wed, 13 Apr 2016 15:30:00 -0000 [thread overview]
Message-ID: <570E661E.80908@redhat.com> (raw)
In-Reply-To: <20160413144058.GB5531@embecosm.com>
Hi Andrew,
>> Would this function ever return a negative value ? I assume not, so
>> it would make sense for its return type to be "unsigned int".
>
> I'm not sure is the answer. I agree that arc_insn_length will never
> return a negative, however, the return value from arc_insn_length is
> used to prime a variable that is then the return value for
> print_insn_arc, which is also defined to return 'int', and is part of
> the disassembler API, and does return a negative value if there's an
> error.
>
> It was this relationship that originally lead me to make
> arc_insn_length return an 'int'.
>
> Given that it will only ever return small positive integers there
> should be no problem making it return an unsigned value then casting
> to int in print_insn_arc - would this be preferred?
Yes. Or (better IMHO) just explicitly set the return value for
print_insn_arc based upon testing the return value from arc_insn_length.
Ie something like:
len = arc_insn_length (...);
if (len == 0)
return -1;
(I am assuming here that a returned length of zero should never happen
with a valid instruction, and can therefore be used as an error return
value).
Cheers
Nick
next prev parent reply other threads:[~2016-04-13 15:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-12 11:00 [PATCHv2 0/3] ARC: Add another group of nps instructions Andrew Burgess
2016-04-07 11:05 ` [PATCH " Andrew Burgess
2016-04-07 11:05 ` [PATCH 2/3] bfd/arc: Rename enum entries to avoid conflicts Andrew Burgess
2016-04-07 11:20 ` Claudiu Zissulescu
2016-04-07 11:05 ` [PATCH 1/3] opcodes/arc: Compute insn lengths in disassembler Andrew Burgess
2016-04-07 11:27 ` Claudiu Zissulescu
2016-04-12 9:27 ` Claudiu Zissulescu
2016-04-07 11:05 ` [PATCH 3/3] arc/nps400 : New cmem instructions and associated relocation Andrew Burgess
2016-04-11 12:55 ` Cupertino Miranda
2016-04-12 11:00 ` [PATCHv2 2/3] bfd/arc: Rename enum entries to avoid conflicts Andrew Burgess
2016-04-13 13:34 ` Nick Clifton
2016-04-12 11:00 ` [PATCHv2 1/3] opcodes/arc: Move instruction length logic to new function Andrew Burgess
2016-04-12 12:27 ` Claudiu Zissulescu
2016-04-13 13:32 ` Nick Clifton
2016-04-13 14:41 ` Andrew Burgess
2016-04-13 15:30 ` Nick Clifton [this message]
2016-04-14 12:40 ` Andrew Burgess
2016-04-14 14:45 ` Nick Clifton
2016-04-12 11:00 ` [PATCHv2 3/3] arc/nps400 : New cmem instructions and associated relocation Andrew Burgess
2016-04-13 13:37 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=570E661E.80908@redhat.com \
--to=nickc@redhat.com \
--cc=Claudiu.Zissulescu@synopsys.com \
--cc=Cupertino.Miranda@synopsys.com \
--cc=andrew.burgess@embecosm.com \
--cc=binutils@sourceware.org \
--cc=noamca@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).