Remove the unused &^ AmpHat operator

This commit is contained in:
Nigel Tao committed 2018-04-26 11:24:27 +10:00
1 parent 95815036ba
commit 7f0923a9cf
7 files changed
+33 -51

No files matched your search

-3
View File
@@ -517,7 +517,6 @@ func (g *gen) writeExprBinaryOp(b *buffer, n *a.Expr, rp replacementPolicy, pp p
if err := g.writeExpr(b, n.LHS().Expr(), rp, parenthesesMandatory, depth); err != nil { if err := g.writeExpr(b, n.LHS().Expr(), rp, parenthesesMandatory, depth); err != nil {
return err return err
} }
// TODO: does KeyXBinaryAmpHat need special consideration?
b.writes(opName) b.writes(opName)
if err := g.writeExpr(b, n.RHS().Expr(), rp, parenthesesMandatory, depth); err != nil { if err := g.writeExpr(b, n.RHS().Expr(), rp, parenthesesMandatory, depth); err != nil {
return err return err
@@ -681,7 +680,6 @@ var cOpNames = [256]string{
t.IDShiftLEq: " <<= ", t.IDShiftLEq: " <<= ",
t.IDShiftREq: " >>= ", t.IDShiftREq: " >>= ",
t.IDAmpEq: " &= ", t.IDAmpEq: " &= ",
t.IDAmpHatEq: " no_such_C_operator ",
t.IDPipeEq: " |= ", t.IDPipeEq: " |= ",
t.IDHatEq: " ^= ", t.IDHatEq: " ^= ",
t.IDPercentEq: " %= ", t.IDPercentEq: " %= ",
@@ -703,7 +701,6 @@ var cOpNames = [256]string{
t.IDXBinaryShiftL: " << ", t.IDXBinaryShiftL: " << ",
t.IDXBinaryShiftR: " >> ", t.IDXBinaryShiftR: " >> ",
t.IDXBinaryAmp: " & ", t.IDXBinaryAmp: " & ",
t.IDXBinaryAmpHat: " no_such_C_operator ",
t.IDXBinaryPipe: " | ", t.IDXBinaryPipe: " | ",
t.IDXBinaryHat: " ^ ", t.IDXBinaryHat: " ^ ",
t.IDXBinaryPercent: " % ", t.IDXBinaryPercent: " % ",
+1 -1
View File
@@ -81,7 +81,7 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
if err := g.writeExpr(b, n.LHS(), replaceCallSuspendibles, parenthesesMandatory, depth); err != nil { if err := g.writeExpr(b, n.LHS(), replaceCallSuspendibles, parenthesesMandatory, depth); err != nil {
return err return err
} }
// TODO: `~sat+=`, `~sat-=` and `&^=` need special consideration. // TODO: `~sat+=` and `~sat-=` need special consideration.
op := n.Operator() op := n.Operator()
opName := cOpNames[0xFF&op] opName := cOpNames[0xFF&op]
if opName == "" { if opName == "" {
+2 -1
View File
@@ -12,6 +12,7 @@
- Let the `std/zlib` decoder ignore checksums. - Let the `std/zlib` decoder ignore checksums.
- Renamed `std/flate` to `std/deflate`. - Renamed `std/flate` to `std/deflate`.
- Renamed `~+` to `~mod+`; added `~mod-`, `~sat+` and `~sat-`. - Renamed `~+` to `~mod+`; added `~mod-`, `~sat+` and `~sat-`.
- Removed `&^`.
- Renamed `[N] T` and `[] T` types to `array[N] T` and `slice T`. - Renamed `[N] T` and `[] T` types to `array[N] T` and `slice T`.
- Renamed `iterate.N` to `iterate[N]`. - Renamed `iterate.N` to `iterate[N]`.
- Renamed `buf1`, `reader1`, etc to `io_buffer`, `io_reader`, etc. - Renamed `buf1`, `reader1`, etc to `io_buffer`, `io_reader`, etc.
@@ -27,7 +28,7 @@
- Added a stand-alone lang/interval package. - Added a stand-alone lang/interval package.
- Added fuzz tests. - Added fuzz tests.
- Added some Go and Rust benchmarks. - Added some Go and Rust benchmarks.
- Sped up the mimic\_deflate\_xxx benchmarks. - Sped up the `mimic_deflate_xxx` benchmarks.
## 2017-11-16 ## 2017-11-16
-1
View File
@@ -166,7 +166,6 @@ var opStrings = [256]string{
t.IDXBinaryShiftL: " << ", t.IDXBinaryShiftL: " << ",
t.IDXBinaryShiftR: " >> ", t.IDXBinaryShiftR: " >> ",
t.IDXBinaryAmp: " & ", t.IDXBinaryAmp: " & ",
t.IDXBinaryAmpHat: " &^ ",
t.IDXBinaryPipe: " | ", t.IDXBinaryPipe: " | ",
t.IDXBinaryHat: " ^ ", t.IDXBinaryHat: " ^ ",
t.IDXBinaryTildeModPlus: " ~mod+ ", t.IDXBinaryTildeModPlus: " ~mod+ ",
-3
View File
@@ -1118,9 +1118,6 @@ func (q *checker) bcheckExprBinaryOp1(op t.ID, lhs *a.Expr, lMin *big.Int, lMax
// conservative, but works fine in practice. // conservative, but works fine in practice.
return zero, bitMask(z.BitLen()), nil return zero, bitMask(z.BitLen()), nil
case t.IDXBinaryAmpHat:
// TODO.
case t.IDXBinaryPercent: case t.IDXBinaryPercent:
if lMin.Sign() < 0 { if lMin.Sign() < 0 {
return nil, nil, fmt.Errorf("check: modulus op argument %q is possibly negative", lhs.Str(q.tm)) return nil, nil, fmt.Errorf("check: modulus op argument %q is possibly negative", lhs.Str(q.tm))
-2
View File
@@ -880,8 +880,6 @@ func evalConstValueBinaryOp(tm *t.Map, n *a.Expr, l *big.Int, r *big.Int) (*big.
return big.NewInt(0).Rsh(l, uint(r.Uint64())), nil return big.NewInt(0).Rsh(l, uint(r.Uint64())), nil
case t.IDXBinaryAmp: case t.IDXBinaryAmp:
return big.NewInt(0).And(l, r), nil return big.NewInt(0).And(l, r), nil
case t.IDXBinaryAmpHat:
return big.NewInt(0).AndNot(l, r), nil
case t.IDXBinaryPipe: case t.IDXBinaryPipe:
return big.NewInt(0).Or(l, r), nil return big.NewInt(0).Or(l, r), nil
case t.IDXBinaryHat: case t.IDXBinaryHat:
+30 -40
View File
@@ -203,14 +203,13 @@ const (
IDShiftLEq = ID(0x15) IDShiftLEq = ID(0x15)
IDShiftREq = ID(0x16) IDShiftREq = ID(0x16)
IDAmpEq = ID(0x17) IDAmpEq = ID(0x17)
IDAmpHatEq = ID(0x18) IDPipeEq = ID(0x18)
IDPipeEq = ID(0x19) IDHatEq = ID(0x19)
IDHatEq = ID(0x1A) IDPercentEq = ID(0x1A)
IDPercentEq = ID(0x1B) IDTildeModPlusEq = ID(0x1B)
IDTildeModPlusEq = ID(0x1C) IDTildeModMinusEq = ID(0x1C)
IDTildeModMinusEq = ID(0x1D) IDTildeSatPlusEq = ID(0x1D)
IDTildeSatPlusEq = ID(0x1E) IDTildeSatMinusEq = ID(0x1E)
IDTildeSatMinusEq = ID(0x1F)
) )
const ( const (
@@ -228,14 +227,13 @@ const (
IDShiftL = ID(0x25) IDShiftL = ID(0x25)
IDShiftR = ID(0x26) IDShiftR = ID(0x26)
IDAmp = ID(0x27) IDAmp = ID(0x27)
IDAmpHat = ID(0x28) IDPipe = ID(0x28)
IDPipe = ID(0x29) IDHat = ID(0x29)
IDHat = ID(0x2A) IDPercent = ID(0x2A)
IDPercent = ID(0x2B) IDTildeModPlus = ID(0x2B)
IDTildeModPlus = ID(0x2C) IDTildeModMinus = ID(0x2C)
IDTildeModMinus = ID(0x2D) IDTildeSatPlus = ID(0x2D)
IDTildeSatPlus = ID(0x2E) IDTildeSatMinus = ID(0x2E)
IDTildeSatMinus = ID(0x2F)
IDNotEq = ID(0x30) IDNotEq = ID(0x30)
IDLessThan = ID(0x31) IDLessThan = ID(0x31)
@@ -267,23 +265,22 @@ const (
IDXBinaryShiftL = ID(0x4C) IDXBinaryShiftL = ID(0x4C)
IDXBinaryShiftR = ID(0x4D) IDXBinaryShiftR = ID(0x4D)
IDXBinaryAmp = ID(0x4E) IDXBinaryAmp = ID(0x4E)
IDXBinaryAmpHat = ID(0x4F) IDXBinaryPipe = ID(0x4F)
IDXBinaryPipe = ID(0x50) IDXBinaryHat = ID(0x50)
IDXBinaryHat = ID(0x51) IDXBinaryPercent = ID(0x51)
IDXBinaryPercent = ID(0x52) IDXBinaryTildeModPlus = ID(0x52)
IDXBinaryTildeModPlus = ID(0x53) IDXBinaryTildeModMinus = ID(0x53)
IDXBinaryTildeModMinus = ID(0x54) IDXBinaryTildeSatPlus = ID(0x54)
IDXBinaryTildeSatPlus = ID(0x55) IDXBinaryTildeSatMinus = ID(0x55)
IDXBinaryTildeSatMinus = ID(0x56) IDXBinaryNotEq = ID(0x56)
IDXBinaryNotEq = ID(0x57) IDXBinaryLessThan = ID(0x57)
IDXBinaryLessThan = ID(0x58) IDXBinaryLessEq = ID(0x58)
IDXBinaryLessEq = ID(0x59) IDXBinaryEqEq = ID(0x59)
IDXBinaryEqEq = ID(0x5A) IDXBinaryGreaterEq = ID(0x5A)
IDXBinaryGreaterEq = ID(0x5B) IDXBinaryGreaterThan = ID(0x5B)
IDXBinaryGreaterThan = ID(0x5C) IDXBinaryAnd = ID(0x5C)
IDXBinaryAnd = ID(0x5D) IDXBinaryOr = ID(0x5D)
IDXBinaryOr = ID(0x5E) IDXBinaryAs = ID(0x5E)
IDXBinaryAs = ID(0x5F)
IDXAssociativePlus = ID(0x60) IDXAssociativePlus = ID(0x60)
IDXAssociativeStar = ID(0x61) IDXAssociativeStar = ID(0x61)
@@ -443,7 +440,6 @@ var builtInsByID = [nBuiltInIDs]string{
IDShiftLEq: "<<=", IDShiftLEq: "<<=",
IDShiftREq: ">>=", IDShiftREq: ">>=",
IDAmpEq: "&=", IDAmpEq: "&=",
IDAmpHatEq: "&^=",
IDPipeEq: "|=", IDPipeEq: "|=",
IDHatEq: "^=", IDHatEq: "^=",
IDPercentEq: "%=", IDPercentEq: "%=",
@@ -459,7 +455,6 @@ var builtInsByID = [nBuiltInIDs]string{
IDShiftL: "<<", IDShiftL: "<<",
IDShiftR: ">>", IDShiftR: ">>",
IDAmp: "&", IDAmp: "&",
IDAmpHat: "&^",
IDPipe: "|", IDPipe: "|",
IDHat: "^", IDHat: "^",
IDPercent: "%", IDPercent: "%",
@@ -639,8 +634,6 @@ var lexers = [nBuiltInIDs][]suffixLexer{
{"", IDExclam}, {"", IDExclam},
}, },
'&': { '&': {
{"^=", IDAmpHatEq},
{"^", IDAmpHat},
{"=", IDAmpEq}, {"=", IDAmpEq},
{"", IDAmp}, {"", IDAmp},
}, },
@@ -714,7 +707,6 @@ var ambiguousForms = [nBuiltInIDs]ID{
IDXBinaryShiftL: IDShiftL, IDXBinaryShiftL: IDShiftL,
IDXBinaryShiftR: IDShiftR, IDXBinaryShiftR: IDShiftR,
IDXBinaryAmp: IDAmp, IDXBinaryAmp: IDAmp,
IDXBinaryAmpHat: IDAmpHat,
IDXBinaryPipe: IDPipe, IDXBinaryPipe: IDPipe,
IDXBinaryHat: IDHat, IDXBinaryHat: IDHat,
IDXBinaryPercent: IDPercent, IDXBinaryPercent: IDPercent,
@@ -783,7 +775,6 @@ var binaryForms = [nBuiltInIDs]ID{
IDShiftLEq: IDXBinaryShiftL, IDShiftLEq: IDXBinaryShiftL,
IDShiftREq: IDXBinaryShiftR, IDShiftREq: IDXBinaryShiftR,
IDAmpEq: IDXBinaryAmp, IDAmpEq: IDXBinaryAmp,
IDAmpHatEq: IDXBinaryAmpHat,
IDPipeEq: IDXBinaryPipe, IDPipeEq: IDXBinaryPipe,
IDHatEq: IDXBinaryHat, IDHatEq: IDXBinaryHat,
IDPercentEq: IDXBinaryPercent, IDPercentEq: IDXBinaryPercent,
@@ -799,7 +790,6 @@ var binaryForms = [nBuiltInIDs]ID{
IDShiftL: IDXBinaryShiftL, IDShiftL: IDXBinaryShiftL,
IDShiftR: IDXBinaryShiftR, IDShiftR: IDXBinaryShiftR,
IDAmp: IDXBinaryAmp, IDAmp: IDXBinaryAmp,
IDAmpHat: IDXBinaryAmpHat,
IDPipe: IDXBinaryPipe, IDPipe: IDXBinaryPipe,
IDHat: IDXBinaryHat, IDHat: IDXBinaryHat,
IDPercent: IDXBinaryPercent, IDPercent: IDXBinaryPercent,