位运算的请教 #80
Answered
by
Codesire-Deng
KleinSteven
asked this question in
Q&A
位运算的请教
#80
-
在 io_info.as_user_data() | uint64_t(user_data_type::task_info_ptr) 通过这样一个位运算实现了将数据类型及其地址保存到 在取出时为什么可以通过 mux selector = mux(uint8_t(user_data & 0b111)) 获取枚举的类型? |
Beta Was this translation helpful? Give feedback.
Answered by
Codesire-Deng
Sep 28, 2023
Replies: 1 comment
-
这是因为 user_data_type 只需用到最低的 3 个 bits,故 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Codesire-Deng
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这是因为 user_data_type 只需用到最低的 3 个 bits,故
user_data & 0b111
足以还原 user_data_type。