轮班操作在条件下使用的说明
Explanation of shift operationals use in condition
我有一个c代码给我填写我的论文。您能否解释一下以下部分的作用,因为我对此非常满意。
int i;
_int8 codeword[64800];
//loop running through codeword
if (codeword[i << 1] << 1 | codeword[i << 1 | 1])
{
//more code here
}
其中 i 是一个循环计数器和 码字[]是一个由一和零组成的一维矩阵
我主要寻求对发生的操作的解释,例如,如果代码字[i]为1。
该测试将偏移量2 * i
和2 * i + 1
的 2 位codeword
组合在一起,如果它们不是两个0
,则评估主体。 表达式解析为:
int i;
_int8 codeword[64800];
//loop running through codeword
if ((codeword[i << 1] << 1) | codeword[(i << 1) | 1]) {
// more code here
}
请注意,该表达式将等效,但更具可读性,如下所示:
int i;
_int8 codeword[64800];
//loop running through codeword
if (codeword[2 * i] || codeword[2 * i + 1]) {
// more code here
}
相关文章:
- 为什么简单的算术减法在"if"条件下不起作用?
- 在什么条件下使用 std::memcpy 在对象之间复制是安全的?
- 改进简单条件下C++样式
- 唤醒多个线程以在每个条件下工作一次
- "is defined"宏检查及其调用必须处于不同的条件下吗?
- 在if条件下,右或左改变值的相等性检查是否有任何区别
- C++代码在 for 循环的条件下给出运行时错误,而如果它被具有相同意义的代码替换,则编译正确
- 在 constexpr-if 条件下比较 constexpr 函数参数会导致错误
- 轮班操作在条件下使用的说明
- 在不同条件下无法访问我的向量变量
- 在某些条件下最大化 GCD
- 如何更改此空隙函数,以便在特殊条件下返回一个生成的字符串
- 在if-Statement条件下与分配有关的错误
- 如何正确使用“ sizeof”操作员在循环的条件下正确使用
- 提升::MSM 检查保护条件下的状态转换
- C++在 IF 条件下递增
- C 在循环条件下忽略
- Bool Vector 2D数组在IF条件下使用
- 现代C++编译器是否能够避免在某些条件下两次调用常量函数
- 算子!() 和运算符 --() 在 if 条件下