You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use more appropriate types for base, precision and width #116
@mickjc750 : This issue report is inspired by your commit b907595 , where you've done something similar. Which of the types do you believe is more appropriate?
For base, just a simple uint8_t, as there's no arithmetic performed on base
which would require masking it down to 8bits on a 32bit cpu.
For precision and width, uint_fast8_t would provide a slightly smaller (and
faster) executable than uint8_t , as there are places where precision is
decremented.
In the ntoa(), I'd recommend using literal values %2 %8 %10 %16 rather than
%base, as it saves performing a division. It's a minor size increase for a
big performance increase.
--
--
Michael Clift - Design Engineer.
Clift Innovations Pty Ltd
Suit 10/13 Walkers Road
Nunawading, VIC 3131
ABN 24 286188328
Tel: +61 3 9877 3109
Fax: +61 3 9999 1406
Mob: 0417 613 680
Email: ***@***.***
Web: www.clift.com.au
*****************************************************************************
PRIVATE AND CONFIDENTIAL
This e-mail and any files transmitted with it are intended solely for the
use of the addressee(s) and may contain information that is confidential or
privileged. If you receive this e-mail and you are not the addressee(s),
please disregard the contents of the e-mail, delete the e-mail and notify
the author immediately.
*****************************************************************************
@mickjc750 : You've packaged several issues into one... anyway, are we sure width always fits in a uint8_t ?
Also, please try to avoid commenting by replying to the email and quoting everything. If you reply, please quote nothing. Otherwise we get a huge quoted-part of your comment which doesn't add any new information.
Not 100% sure. It really comes down to opinion as to what a reasonable
width limit is.
Printf is generating text, 255 sounds like a reasonable limit for the
width of a number. Or the width of a field with a %s aligned in it.
Activity
eyalroz commentedon Jul 31, 2021
@mickjc750 : This issue report is inspired by your commit b907595 , where you've done something similar. Which of the types do you believe is more appropriate?
mickjc750 commentedon Aug 1, 2021
[-]Use a single, appropriate type for the base[/-][+]Use a single, appropriate type for base, precision and width[/+][-]Use a single, appropriate type for base, precision and width[/-][+]Use a single, appropriate type for base[/+][-]Use a single, appropriate type for base[/-][+]Use more appropriate types for base, precision and width[/+]eyalroz commentedon Aug 1, 2021
@mickjc750 : You've packaged several issues into one... anyway, are we sure width always fits in a uint8_t ?
Also, please try to avoid commenting by replying to the email and quoting everything. If you reply, please quote nothing. Otherwise we get a huge quoted-part of your comment which doesn't add any new information.
mickjc750 commentedon Aug 1, 2021
Regards mpaland#116 : Defined a (hopefully) appropriate type and some…
Regards mpaland#116 : Defined a (hopefully) appropriate type and some…
Regards mpaland#116 : Defined a (hopefully) appropriate type and some…