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

[Tutorial 04] 关于「& 0xFF」的问题 #226

Open
Haceau-Zoac opened this issue Jul 4, 2022 · 1 comment
Open

[Tutorial 04] 关于「& 0xFF」的问题 #226

Haceau-Zoac opened this issue Jul 4, 2022 · 1 comment

Comments

@Haceau-Zoac
Copy link

3. UTF-8 编码 处,代码里有 (u >> 12) & 0xFF,0xFF = 11111111,对它进行逻辑与操作和不进行不一样吗?

@zjb1001
Copy link

zjb1001 commented Jan 2, 2024

不等价,0xFF保证获取最低八位
以u(24bit)为例,u >> 12后,u还剩下12bit,而(u >> 12) & 0xFF 只有低8bit

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

No branches or pull requests

2 participants