[llvm] r183345 - Add writeAsBinary(raw_ostream &) method to BinaryRef.

Sean Silva silvas at purdue.edu
Fri Jun 7 12:25:15 PDT 2013


On Thu, Jun 6, 2013 at 9:56 AM, Shankar Easwaran <shankare at codeaurora.org>wrote:

> On 6/5/2013 5:59 PM, Sean Silva wrote:
>
>>   +// Can't find this anywhere else in the codebase (clang has one, but
>> it has
>> +// some baggage). Deduplicate as required.
>> +static bool isHexDigit(uint8_t C) {
>> +  return ('0' <= C && C <= '9') ||
>> +         ('A' <= C && C <= 'F') ||
>> +         ('a' <= C && C <= 'f');
>> +}
>> +
>>
> Can this be inlined in the code using it ? Found only one use.
>

I couldn't find a suitable function in the codebase, but since this seemed
like common functionality that was sure to exist somewhere, my goal here
was to indicate the code's intent, so that it would be easy to identify and
replace with common functionality by someone who knew where that
functionality was (it seems like my plan worked, with d0k suggesting
isxdigit).

Also, factoring out predicates like this is generally good practice for
readability. The compiler will happily inline it.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130607/88790c34/attachment.html>


More information about the llvm-commits mailing list