Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改位操作示例展示效果 #1383

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tianq02
Copy link

@tianq02 tianq02 commented Feb 18, 2024

修改示例数据类型为u8。原先的i32长度过长不便01二进制展示;且取反操作会一同反转符号位,或许会造成读者疑惑。
展示输出中使用{:08b}格式化并对齐,应该更加直观。

修改后的运行效果如下

PS D:\pro\rustworks\playground\demo_binop> cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target\debug\demo_binop.exe`
a value is        00000010
b value is        00000011
(a & b) value is  00000010
(a | b) value is  00000011
(a ^ b) value is  00000001
(!b) value is     11111100
(a << b) value is 00010000
(a >> b) value is 00000000
(a << b) value is 00010000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant