> For the complete documentation index, see [llms.txt](https://documentation.soulver.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.soulver.app/zh/yu-fa-can-kao/bases-and-bitwise.md).

# 进制与位运算

### 十进制、十六进制、二进制与八进制

Soulver 支持基数 2（二进制）、八进制（基数 8）和十六进制（基数 16），并支持各种格式之间的转换。

```
# 转换器
256 作为十六进制 | 0x100
99 的二进制表示 | 0b1100011
0x9F31 到十进制 | 40,753
0b1000101 到八进制 | 0o105

# 短语
0b101101 作为八进制 | 0o55
0x2D 作为二进制 | 0b101101

# Python 风格函数
int(0o55)          | 45
hex(99)            | 0x63
bin(0x73)          | 0b1110011
```

### 位运算符

| 运算符       | 名称                         |
| --------- | -------------------------- |
| & 或 AND   | 按位与 (Bitwise AND)          |
| \| 或 OR   | 按位或 (Bitwise OR)           |
| xor 或 XOR | 按位异或 (Bitwise XOR)         |
| <<        | 按位左移 (Bitwise left shift)  |
| >>        | 按位右移 (Bitwise right shift) |
