diff options
| -rw-r--r-- | dynasm/dasm_arm64.h | 12 | ||||
| -rw-r--r-- | dynasm/dasm_mips.h | 8 |
2 files changed, 11 insertions, 9 deletions
diff --git a/dynasm/dasm_arm64.h b/dynasm/dasm_arm64.h index 975f5867..47c9c37d 100644 --- a/dynasm/dasm_arm64.h +++ b/dynasm/dasm_arm64.h | |||
| @@ -158,10 +158,10 @@ void dasm_setup(Dst_DECL, const void *actionlist) | |||
| 158 | #ifdef DASM_CHECKS | 158 | #ifdef DASM_CHECKS |
| 159 | #define CK(x, st) \ | 159 | #define CK(x, st) \ |
| 160 | do { if (!(x)) { \ | 160 | do { if (!(x)) { \ |
| 161 | D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0) | 161 | D->status = DASM_S_##st|(int)(p-D->actionlist-1); return; } } while (0) |
| 162 | #define CKPL(kind, st) \ | 162 | #define CKPL(kind, st) \ |
| 163 | do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \ | 163 | do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \ |
| 164 | D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0) | 164 | D->status = DASM_S_RANGE_##st|(int)(p-D->actionlist-1); return; } } while (0) |
| 165 | #else | 165 | #else |
| 166 | #define CK(x, st) ((void)0) | 166 | #define CK(x, st) ((void)0) |
| 167 | #define CKPL(kind, st) ((void)0) | 167 | #define CKPL(kind, st) ((void)0) |
| @@ -190,7 +190,9 @@ static int dasm_imm13(int lo, int hi) | |||
| 190 | unsigned long long n = (((unsigned long long)hi) << 32) | (unsigned int)lo; | 190 | unsigned long long n = (((unsigned long long)hi) << 32) | (unsigned int)lo; |
| 191 | unsigned long long m = 1ULL, a, b, c; | 191 | unsigned long long m = 1ULL, a, b, c; |
| 192 | if (n & 1) { n = ~n; inv = 1; } | 192 | if (n & 1) { n = ~n; inv = 1; } |
| 193 | a = n & -n; b = (n+a)&-(n+a); c = (n+a-b)&-(n+a-b); | 193 | a = n & (unsigned long long)-(long long)n; |
| 194 | b = (n+a)&(unsigned long long)-(long long)(n+a); | ||
| 195 | c = (n+a-b)&(unsigned long long)-(long long)(n+a-b); | ||
| 194 | xa = dasm_ffs(a); xb = dasm_ffs(b); | 196 | xa = dasm_ffs(a); xb = dasm_ffs(b); |
| 195 | if (c) { | 197 | if (c) { |
| 196 | w = dasm_ffs(c) - xa; | 198 | w = dasm_ffs(c) - xa; |
| @@ -406,7 +408,7 @@ int dasm_link(Dst_DECL, size_t *szp) | |||
| 406 | 408 | ||
| 407 | #ifdef DASM_CHECKS | 409 | #ifdef DASM_CHECKS |
| 408 | #define CK(x, st) \ | 410 | #define CK(x, st) \ |
| 409 | do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0) | 411 | do { if (!(x)) return DASM_S_##st|(int)(p-D->actionlist-1); } while (0) |
| 410 | #else | 412 | #else |
| 411 | #define CK(x, st) ((void)0) | 413 | #define CK(x, st) ((void)0) |
| 412 | #endif | 414 | #endif |
| @@ -554,7 +556,7 @@ int dasm_checkstep(Dst_DECL, int secmatch) | |||
| 554 | } | 556 | } |
| 555 | if (D->status == DASM_S_OK && secmatch >= 0 && | 557 | if (D->status == DASM_S_OK && secmatch >= 0 && |
| 556 | D->section != &D->sections[secmatch]) | 558 | D->section != &D->sections[secmatch]) |
| 557 | D->status = DASM_S_MATCH_SEC|(D->section-D->sections); | 559 | D->status = DASM_S_MATCH_SEC|(int)(D->section-D->sections); |
| 558 | return D->status; | 560 | return D->status; |
| 559 | } | 561 | } |
| 560 | #endif | 562 | #endif |
diff --git a/dynasm/dasm_mips.h b/dynasm/dasm_mips.h index c92c9bf4..3e99a005 100644 --- a/dynasm/dasm_mips.h +++ b/dynasm/dasm_mips.h | |||
| @@ -155,10 +155,10 @@ void dasm_setup(Dst_DECL, const void *actionlist) | |||
| 155 | #ifdef DASM_CHECKS | 155 | #ifdef DASM_CHECKS |
| 156 | #define CK(x, st) \ | 156 | #define CK(x, st) \ |
| 157 | do { if (!(x)) { \ | 157 | do { if (!(x)) { \ |
| 158 | D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0) | 158 | D->status = DASM_S_##st|(int)(p-D->actionlist-1); return; } } while (0) |
| 159 | #define CKPL(kind, st) \ | 159 | #define CKPL(kind, st) \ |
| 160 | do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \ | 160 | do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \ |
| 161 | D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0) | 161 | D->status = DASM_S_RANGE_##st|(int)(p-D->actionlist-1); return; } } while (0) |
| 162 | #else | 162 | #else |
| 163 | #define CK(x, st) ((void)0) | 163 | #define CK(x, st) ((void)0) |
| 164 | #define CKPL(kind, st) ((void)0) | 164 | #define CKPL(kind, st) ((void)0) |
| @@ -314,7 +314,7 @@ int dasm_link(Dst_DECL, size_t *szp) | |||
| 314 | 314 | ||
| 315 | #ifdef DASM_CHECKS | 315 | #ifdef DASM_CHECKS |
| 316 | #define CK(x, st) \ | 316 | #define CK(x, st) \ |
| 317 | do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0) | 317 | do { if (!(x)) return DASM_S_##st|(int)(p-D->actionlist-1); } while (0) |
| 318 | #else | 318 | #else |
| 319 | #define CK(x, st) ((void)0) | 319 | #define CK(x, st) ((void)0) |
| 320 | #endif | 320 | #endif |
| @@ -417,7 +417,7 @@ int dasm_checkstep(Dst_DECL, int secmatch) | |||
| 417 | } | 417 | } |
| 418 | if (D->status == DASM_S_OK && secmatch >= 0 && | 418 | if (D->status == DASM_S_OK && secmatch >= 0 && |
| 419 | D->section != &D->sections[secmatch]) | 419 | D->section != &D->sections[secmatch]) |
| 420 | D->status = DASM_S_MATCH_SEC|(D->section-D->sections); | 420 | D->status = DASM_S_MATCH_SEC|(int)(D->section-D->sections); |
| 421 | return D->status; | 421 | return D->status; |
| 422 | } | 422 | } |
| 423 | #endif | 423 | #endif |
