aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-operators.h
blob: dab44e908c5e68f5cb8fc9c0af6574ad3fc8afbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (C) 2020-2023 Free Software Foundation, Inc.

// This file is part of GCC.

// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3, or (at your option) any later
// version.

// GCC is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.

// You should have received a copy of the GNU General Public License
// along with GCC; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

#ifndef RUST_OPERATOR_H
#define RUST_OPERATOR_H

enum class NegationOperator
{
  NEGATE,
  NOT
};

enum class ArithmeticOrLogicalOperator
{
  ADD,	       // std::ops::Add
  SUBTRACT,    // std::ops::Sub
  MULTIPLY,    // std::ops::Mul
  DIVIDE,      // std::ops::Div
  MODULUS,     // std::ops::Rem
  BITWISE_AND, // std::ops::BitAnd
  BITWISE_OR,  // std::ops::BitOr
  BITWISE_XOR, // std::ops::BitXor
  LEFT_SHIFT,  // std::ops::Shl
  RIGHT_SHIFT  // std::ops::Shr
};

enum class ComparisonOperator
{
  EQUAL,	    // std::cmp::PartialEq::eq
  NOT_EQUAL,	    // std::cmp::PartialEq::ne
  GREATER_THAN,	    // std::cmp::PartialEq::gt
  LESS_THAN,	    // std::cmp::PartialEq::lt
  GREATER_OR_EQUAL, // std::cmp::PartialEq::ge
  LESS_OR_EQUAL	    // std::cmp::PartialEq::le
};

enum class LazyBooleanOperator
{
  LOGICAL_OR,
  LOGICAL_AND
};

enum class CompoundAssignmentOperator
{
  ADD,	       // std::ops::AddAssign
  SUBTRACT,    // std::ops::SubAssign
  MULTIPLY,    // std::ops::MulAssign
  DIVIDE,      // std::ops::DivAssign
  MODULUS,     // std::ops::RemAssign
  BITWISE_AND, // std::ops::BitAndAssign
  BITWISE_OR,  // std::ops::BitOrAssign
  BITWISE_XOR, // std::ops::BitXorAssign
  LEFT_SHIFT,  // std::ops::ShlAssign
  RIGHT_SHIFT  // std::ops::ShrAssign
};

#endif // RUST_OPERATOR_H