【发布时间】:2010-06-22 02:36:57
【问题描述】:
我想在我的 C 文件中定义一些常量。
它的汇编代码如下:
Const1 = 0
Const2 = 0
IF Condition1_SUPPORT
Const1 = Const1 or (1 shl 6)
Const2 = Const2 or (1 shl 3)
ENDIF
IF Condition2_SUPPORT
Const1 = Const1 or (1 shl 5)
Const2 = Const2 or (1 shl 2)
ENDIF
你能告诉我最简单的实现方法吗?
而且它应该足够灵活,因为我的 constants 和 conditions 的数量都超过 10 个。
看到前三个答案后,我想我需要解释一下; 我想知道的是如何根据之前的值重新定义我的常量。
【问题讨论】:
-
你使用的“汇编代码”的定义我想我从来没有听说过
-
我是一名固件工程师,所以我需要将一些汇编代码转换为 C 语言。
标签: c macros constants c-preprocessor