Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 9dc481e

Browse files
hkielOpenModelica-Hudson
authored andcommitted
fix C-macros (missing braces)
1 parent 480ac49 commit 9dc481e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

SimulationRuntime/c/meta/meta_modelica_data.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ typedef int mmc_switch_type;
137137
/* RML-style tagged pointers */
138138
#define MMC_TAGPTR(p) ((void*)((char*)(p) + 3))
139139
#define MMC_UNTAGPTR(x) ((void*)((char*)(x) - 3))
140-
#define MMC_IS_INTEGER(X) (0 == ((mmc_sint_t) X & 1))
140+
#define MMC_IS_INTEGER(X) (0 == ((mmc_sint_t) (X) & 1))
141141
#define MMC_TAGFIXNUM(i) (((i) << 1)+0)
142142
#define MMC_UNTAGFIXNUM(X) (((mmc_sint_t) (X)) >> 1)
143143

144144
#else
145145

146146
#define MMC_TAGPTR(p) ((void*)((char*)(p) + 0))
147147
#define MMC_UNTAGPTR(x) ((void*)((char*)(x) - 0))
148-
#define MMC_IS_INTEGER(X) (1 == ((mmc_sint_t) X & 1))
148+
#define MMC_IS_INTEGER(X) (1 == ((mmc_sint_t) (X) & 1))
149149
#define MMC_TAGFIXNUM(i) (((i) << 1)+1)
150-
#define MMC_UNTAGFIXNUM(X) (((mmc_sint_t) (X-1)) >> 1)
150+
#define MMC_UNTAGFIXNUM(X) (((mmc_sint_t) ((X)-1)) >> 1)
151151

152152
#endif
153153

@@ -175,7 +175,7 @@ typedef int mmc_switch_type;
175175
#define MMC_HDRISSTRING(hdr) (((hdr) & (7)) == 5)
176176
#define MMC_HDRSTRLEN(hdr) (((hdr) >> (3)) - MMC_SIZE_INT)
177177
#define MMC_STRINGDATA(x) (((struct mmc_string*)MMC_UNTAGPTR(x))->data)
178-
#define MMC_HDRSTRINGSLOTS(hdr) (hdr >> (3+MMC_LOG2_SIZE_INT))
178+
#define MMC_HDRSTRINGSLOTS(hdr) ((hdr) >> (3+MMC_LOG2_SIZE_INT))
179179

180180
#define MMC_HDRSLOTS(hdr) ((MMC_HDRISSTRING(hdr)) ? (MMC_HDRSTRINGSLOTS(hdr)) : ((hdr) >> 10))
181181
#define MMC_HDRCTOR(hdr) (((hdr) >> 2) & 255)
@@ -215,7 +215,7 @@ typedef int mmc_switch_type;
215215
#define MMC_DEFSTRINGLIT(NAME,LEN,VAL) \
216216
struct { \
217217
mmc_uint_t header; \
218-
const char data[LEN+1]; \
218+
const char data[(LEN)+1]; \
219219
} NAME = { MMC_STRINGHDR(LEN), VAL }
220220
#define MMC_REFSTRINGLIT(NAME) MMC_TAGPTR(&(NAME).header)
221221

0 commit comments

Comments
 (0)