# 运算与表达式

## 可用运算符

|    Name    | Operator                                     | Example   |
| :--------: | -------------------------------------------- | --------- |
|   + - × ÷  | + - \* /                                     |           |
|   modulo   | #                                            |           |
|  brackets  | ( )                                          |           |
|     and    | @&                                           |           |
|     or     | @\|                                          |           |
|     xor    | @^                                           | b0 xor b1 |
|     not    | @\~                                          | not b3    |
|    连续求和    | b1+b2+···+b14                                | sum(1:14) |
|    连续异或    | b1 xor b2 xor ··· xor b10                    | sum(1:10) |
|    连续逻辑与   | b1 and b2 and ··· and b14                    | and(1:14) |
| CRC8/CRC16 | [了解更多](/cn/mtools-app/ji-suan-crc8-crc16.md) |           |

## 示例

| Rule              | Expression       |
| ----------------- | ---------------- |
| `b2 = b1`         | `b2=b1`          |
| `b4 = b2 + 0x1F`  | `b4 = b2 + 31`   |
| `b15 = b0 xor b1` | `b15 = b0 @^ b1` |
| `b2= not b0`      | b2 = @\~b0       |

* *请将十六进制数转化成十进制*
* *上下拖动表达式有改变计算顺序*
* *运算顺序为自上向下*

## 扩展用法

访问 [mXparser](http://mathparser.org/?s=Bitwise) 网站


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mtoolstec.com/cn/mtools-app/help-or-add-expression.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
