Re: msvcirt: Avoid superfluous comparison in some compilers
On 27 March 2016 at 13:57, Iván Matellanes <matellanesivan(a)gmail.com> wrote:
- if (dir < SEEKDIR_beg || dir > SEEKDIR_end || !(mode & (OPENMODE_in|OPENMODE_out))) + if ((dir != SEEKDIR_beg && dir != SEEKDIR_cur && dir != SEEKDIR_end) || !(mode & (OPENMODE_in|OPENMODE_out))) I'm not sure you're really making it better by adding another comparison. One alternative you may want to consider is just "(unsigned int)dir > SEEKDIR_end".
On 27/03/16 23:30, Henri Verbeet wrote:
On 27 March 2016 at 13:57, Iván Matellanes <matellanesivan(a)gmail.com> wrote:
- if (dir < SEEKDIR_beg || dir > SEEKDIR_end || !(mode & (OPENMODE_in|OPENMODE_out))) + if ((dir != SEEKDIR_beg && dir != SEEKDIR_cur && dir != SEEKDIR_end) || !(mode & (OPENMODE_in|OPENMODE_out))) I'm not sure you're really making it better by adding another comparison. One alternative you may want to consider is just "(unsigned int)dir > SEEKDIR_end". Yes, a cast should do the trick, I will resend. Thanks. Iván
participants (2)
-
Henri Verbeet -
Iván Matellanes