🚀 add bitwise operators or, xor, and

This commit is contained in:
ValKmjolnir
2023-02-16 00:24:32 +08:00
parent 068184f451
commit c8eb1f1d16
9 changed files with 155 additions and 24 deletions

View File

@@ -221,6 +221,19 @@ Unary operators `-` `!` have the same function as C/C++.
!0;
```
Bitwise operators `~` `|` `&` `^` have the same function as C/C++.
```javascript
# these operators will:
# 1. convert f64 to i32 (static_cast<int32_t>)
# 2. do the bitwise function
~0x80000000; # not 2147483647
0x8|0x1; # or
0x1&0x2; # and
0x8^0x1; # xor
```
Operators `=` `+=` `-=` `*=` `/=` `~=` are used in assignment expressions.
```javascript