我发布了我的代码的一小段,两边都有相同表达的错误。错误即将发生:
SET_PHY_WL_TO_VBA_4KB(inputVBA, pCDB->wordline, BLOCK_TYPE_SLC);
它指出:
Error: Same on both sides (CONSTANT_EXPRESSION_RESULT) same_on_both_sides:
BLOCK_T_SL == BLOCK_T_SL is always true regardless of the values of its operands because those operands are identical. This occurs as the logical first operand of ?:
我知道我们将始终具有相同的结果,因此此表达式BLOCK_T_SL == BLOCK_T_SL是多余的,但是我实际上如何更改代码,以免出现该错误,并且该函数执行所需的操作?
#define SET_PHY_WL_TO_VBA_4KB(rVBA, _wl_, _blkType_) SET_PHY_WL_TO_VBA((rVBA).params.vba32Kb, _wl_, _blkType_)
#define SET_PHY_WL_TO_VBA(vba, WL, blkType) (blkType == BLOCK_T_SL ? ((vba).SLC.wl = WL):((vba).QLC.wl = WL))
SET_FMU_IN_PLANE_TO_VBA_4KB(inputVBA, pCDB->fmuInPage);
SET_PLANE_TO_VBA_4KB(inputVBA, pCDB->plane);
SET_FIM_TO_VBA_4KB(inputVBA, (pCDB->fim & 0x3));
SET_STRING_TO_VBA_4KB(inputVBA, pCDB->string, BLOCK_T_SL);
SET_PHY_WL_TO_VBA_4KB(inputVBA, pCDB->wordline, BLOCK_T_SL);
SET_BLOCK_TO_VBA_4KB(inputVBA, pCDB->block);
SET_PS_ID_TO_VBA_4KB(inputVBA, ((pCDB->fim >> 2) & 0x1));
SET_DIE_IN_FIM_TO_VBA_4KB(inputVBA, pCDB->die);
以我的最高评论开头...
但是,您可以将宏更改为使用if/else
。至少,这可能有助于理解/修复:
#define SET_PHY_WL_TO_VBA_4KB(rVBA, _wl_, _blkType_) \
SET_PHY_WL_TO_VBA((rVBA).params.vba32Kb, _wl_, _blkType_)
#define SET_PHY_WL_TO_VBA(vba, WL, blkType) \
do { \
if (blkType == BLOCK_T_SL) \
(vba).SLC.wl = WL; \
else \
(vba).QLC.wl = WL; \
} while (0)