got an SAR, thanks to dalias on IRC
This commit is contained in:
parent
e1a4c3ed28
commit
fb3555d7f5
19
expr.c
19
expr.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.66 2013/04/01 01:29:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.67 2013/04/01 02:28:35 tg Exp $");
|
||||||
|
|
||||||
#if !HAVE_SILENT_IDIVWRAPV
|
#if !HAVE_SILENT_IDIVWRAPV
|
||||||
#if !defined(MKSH_LEGACY_MODE) || HAVE_LONG_32BIT
|
#if !defined(MKSH_LEGACY_MODE) || HAVE_LONG_32BIT
|
||||||
@ -493,19 +493,10 @@ evalexpr(Expr_state *es, int prec)
|
|||||||
break;
|
break;
|
||||||
case O_RSHIFT:
|
case O_RSHIFT:
|
||||||
case O_RSHIFTASN:
|
case O_RSHIFTASN:
|
||||||
if (es->natural)
|
/* how about ANDing with 31 (except lksh)? */
|
||||||
res = vl->val.u >> vr->val.u;
|
res = es->natural || vl->val.i >= 0 ?
|
||||||
else {
|
vl->val.u >> vr->val.u :
|
||||||
/*
|
~(~vl->val.u >> vr->val.u);
|
||||||
* This is implementation-defined in ISO C,
|
|
||||||
* though not undefined, and all known twos
|
|
||||||
* complement implementations make an arith
|
|
||||||
* shift-right out of this, and open-coding
|
|
||||||
* it would probably hurt massively.
|
|
||||||
*/
|
|
||||||
/* how about ANDing? */
|
|
||||||
res = (mksh_uari_t)(vl->val.i >> vr->val.u);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
/* how about rotation? */
|
/* how about rotation? */
|
||||||
case O_LT:
|
case O_LT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user