use ^< and ^> for ROL and ROR in R53, schedule >>> as SAR for R54

cf. http://david.tribble.com/text/c0xrot.htm
This commit is contained in:
tg 2016-07-25 20:41:23 +00:00
parent 54a8067fd2
commit 2364bb5f22
3 changed files with 26 additions and 28 deletions

View File

@ -1,5 +1,5 @@
# $Id$ # $Id$
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.106 2016/07/24 23:05:51 tg Exp $ # $MirOS: src/bin/mksh/dot.mkshrc,v 1.107 2016/07/25 20:41:23 tg Exp $
#- #-
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015, 2016 # 2011, 2012, 2013, 2014, 2015, 2016
@ -365,8 +365,8 @@ function Lbafh_finish {
((# t = (((Lbafh_v >> 7) & 0x01010101) * 0x1B) ^ \ ((# t = (((Lbafh_v >> 7) & 0x01010101) * 0x1B) ^ \
((Lbafh_v << 1) & 0xFEFEFEFE) )) ((Lbafh_v << 1) & 0xFEFEFEFE) ))
((# Lbafh_v = t ^ (t >>> 8) ^ (Lbafh_v >>> 8) ^ \ ((# Lbafh_v = t ^ (t ^> 8) ^ (Lbafh_v ^> 8) ^ \
(Lbafh_v >>> 16) ^ (Lbafh_v >>> 24) )) (Lbafh_v ^> 16) ^ (Lbafh_v ^> 24) ))
\: \:
} }

16
expr.c
View File

@ -23,7 +23,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.86 2016/07/25 00:04:42 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/expr.c,v 1.87 2016/07/25 20:41:23 tg Exp $");
/* the order of these enums is constrained by the order of opinfo[] */ /* the order of these enums is constrained by the order of opinfo[] */
enum token { enum token {
@ -66,7 +66,7 @@ enum token {
#define P_PRIMARY 0 /* VAR, LIT, (), ! ~ ++ -- */ #define P_PRIMARY 0 /* VAR, LIT, (), ! ~ ++ -- */
#define P_MULT 1 /* * / % */ #define P_MULT 1 /* * / % */
#define P_ADD 2 /* + - */ #define P_ADD 2 /* + - */
#define P_SHIFT 3 /* <<< >>> << >> */ #define P_SHIFT 3 /* ^< ^> << >> */
#define P_RELATION 4 /* < <= > >= */ #define P_RELATION 4 /* < <= > >= */
#define P_EQUALITY 5 /* == != */ #define P_EQUALITY 5 /* == != */
#define P_BAND 6 /* & */ #define P_BAND 6 /* & */
@ -75,13 +75,13 @@ enum token {
#define P_LAND 9 /* && */ #define P_LAND 9 /* && */
#define P_LOR 10 /* || */ #define P_LOR 10 /* || */
#define P_TERN 11 /* ?: */ #define P_TERN 11 /* ?: */
/* = += -= *= /= %= <<<= >>>= <<= >>= &= ^= |= */ /* = += -= *= /= %= ^<= ^>= <<= >>= &= ^= |= */
#define P_ASSIGN 12 #define P_ASSIGN 12
#define P_COMMA 13 /* , */ #define P_COMMA 13 /* , */
#define MAX_PREC P_COMMA #define MAX_PREC P_COMMA
struct opinfo { struct opinfo {
char name[5]; char name[4];
/* name length */ /* name length */
uint8_t len; uint8_t len;
/* precedence: lower is higher */ /* precedence: lower is higher */
@ -105,8 +105,8 @@ static const struct opinfo opinfo[] = {
{ "+=", 2, P_ASSIGN }, { "+=", 2, P_ASSIGN },
{ "-=", 2, P_ASSIGN }, { "-=", 2, P_ASSIGN },
#ifndef MKSH_LEGACY_MODE #ifndef MKSH_LEGACY_MODE
{ "<<<=", 4, P_ASSIGN }, /* before <<< */ { "^<=", 3, P_ASSIGN }, /* before ^< */
{ ">>>=", 4, P_ASSIGN }, /* before >>> */ { "^>=", 3, P_ASSIGN }, /* before ^> */
#endif #endif
{ "<<=", 3, P_ASSIGN }, { "<<=", 3, P_ASSIGN },
{ ">>=", 3, P_ASSIGN }, { ">>=", 3, P_ASSIGN },
@ -114,8 +114,8 @@ static const struct opinfo opinfo[] = {
{ "^=", 2, P_ASSIGN }, { "^=", 2, P_ASSIGN },
{ "|=", 2, P_ASSIGN }, { "|=", 2, P_ASSIGN },
#ifndef MKSH_LEGACY_MODE #ifndef MKSH_LEGACY_MODE
{ "<<<", 3, P_SHIFT }, /* before << */ { "^<", 2, P_SHIFT }, /* before ^ */
{ ">>>", 3, P_SHIFT }, /* before >> */ { "^>", 2, P_SHIFT }, /* before ^ */
#endif #endif
{ "<<", 2, P_SHIFT }, { "<<", 2, P_SHIFT },
{ ">>", 2, P_SHIFT }, { ">>", 2, P_SHIFT },

32
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.402 2016/07/25 20:38:04 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.403 2016/07/25 20:41:23 tg Exp $
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ .\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
.\"- .\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -2573,7 +2573,7 @@ Unary operators:
Binary operators: Binary operators:
.Bd -literal -offset indent .Bd -literal -offset indent
, ,
= += \-= *= /= %= \*(Lt\*(Lt\*(Lt= \*(Gt\*(Gt\*(Gt= \*(Lt\*(Lt= \*(Gt\*(Gt= &= \*(ha= \*(Ba= = += \-= *= /= %= \*(Lt\*(Lt= \*(Gt\*(Gt= \*(ha\*(Lt= \*(ha\*(Gt= &= \*(ha= \*(Ba=
\*(Ba\*(Ba \*(Ba\*(Ba
&& &&
\*(Ba \*(Ba
@ -2581,7 +2581,7 @@ Binary operators:
& &
== != == !=
\*(Lt \*(Lt= \*(Gt \*(Gt= \*(Lt \*(Lt= \*(Gt \*(Gt=
\*(Lt\*(Lt\*(Lt \*(Gt\*(Gt\*(Gt \*(Lt\*(Lt \*(Gt\*(Gt \*(Lt\*(Lt \*(Gt\*(Gt \*(ha\*(Lt \*(ha\*(Gt
+ \- + \-
* / % * / %
.Ed .Ed
@ -2670,8 +2670,8 @@ The result is the value of the expression on the right-hand side.
.It = .It =
Assignment; the variable on the left is set to the value on the right. Assignment; the variable on the left is set to the value on the right.
.It Xo .It Xo
.No += \-= *= /= %= \*(Lt\*(Lt\*(Lt= \*(Gt\*(Gt\*(Gt= .No += \-= *= /= %= \*(Lt\*(Lt= \*(Gt\*(Gt=
.No \*(Lt\*(Lt= \*(Gt\*(Gt= &= \*(ha= \*(Ba= .No \*(ha\*(Lt= \*(ha\*(Gt= &= \*(ha= \*(Ba=
.Xc .Xc
Assignment operators. Assignment operators.
.Sm off .Sm off
@ -2721,20 +2721,18 @@ not.
Less than or equal, greater than, greater than or equal. Less than or equal, greater than, greater than or equal.
See See
.Ic \*(Lt . .Ic \*(Lt .
.It \*(Lt\*(Lt\*(Lt \*(Gt\*(Gt\*(Gt
Rotate left (right); the result is similar to shift (see
.Ic \*(Lt\*(Lt )
except that the bits shifted out at one end are shifted in
at the other end, instead of zero or sign bits.
.Pp
.Em Note :
These operators are deprecated; in a subsequent mksh release,
.Ic \*(ha\*(Lt No and Ic \*(ha\*(Gt
.No will replace them, and Ic \*(Gt\*(Gt\*(Gt
will be an arithmetic right shift.
.It \*(Lt\*(Lt \*(Gt\*(Gt .It \*(Lt\*(Lt \*(Gt\*(Gt
Shift left (right); the result is the left argument with its bits logically Shift left (right); the result is the left argument with its bits logically
shifted left (right) by the amount given in the right argument. shifted left (right) by the amount given in the right argument.
.It \*(Gt\*(Gt\*(Gt
Shift arithmetically right; the result is similar to shift,
except that the top-most bit is repeated instead of filling
the newly shifted-in bits with zero.
.Em Scheduled to be implemented in R54 !
.It \*(ha\*(Lt \*(ha\*(Gt
Rotate left (right); the result is similar to shift,
except that the bits shifted out at one end are shifted in
at the other end, instead of zero or sign bits.
.It + \- * / .It + \- * /
Addition, subtraction, multiplication, and division. Addition, subtraction, multiplication, and division.
.It % .It %
@ -6619,7 +6617,7 @@ for the in-memory portion of the history is slow, should use
.Xr memmove 3 . .Xr memmove 3 .
.Pp .Pp
This document attempts to describe This document attempts to describe
.Nm mksh\ R52d .Nm mksh\ R53
and up, and up,
.\" with vendor patches from insert-your-name-here, .\" with vendor patches from insert-your-name-here,
compiled without any options impacting functionality, such as compiled without any options impacting functionality, such as