py, unix: Allow to compile with -Wsign-compare.

See issue #699.
This commit is contained in:
Damien George
2015-01-16 17:47:07 +00:00
parent f12ea7c7ed
commit 963a5a3e82
23 changed files with 53 additions and 51 deletions

View File

@@ -398,7 +398,7 @@ void asm_x86_label_assign(asm_x86_t *as, mp_uint_t label) {
assert(label < as->max_num_labels);
if (as->pass < ASM_X86_PASS_EMIT) {
// assign label offset
assert(as->label_offsets[label] == -1);
assert(as->label_offsets[label] == (mp_uint_t)-1);
as->label_offsets[label] = as->code_offset;
} else {
// ensure label offset has not changed from PASS_COMPUTE to PASS_EMIT
@@ -407,7 +407,7 @@ void asm_x86_label_assign(asm_x86_t *as, mp_uint_t label) {
}
}
STATIC mp_uint_t get_label_dest(asm_x86_t *as, int label) {
STATIC mp_uint_t get_label_dest(asm_x86_t *as, mp_uint_t label) {
assert(label < as->max_num_labels);
return as->label_offsets[label];
}
@@ -415,7 +415,7 @@ STATIC mp_uint_t get_label_dest(asm_x86_t *as, int label) {
void asm_x86_jmp_label(asm_x86_t *as, mp_uint_t label) {
mp_uint_t dest = get_label_dest(as, label);
mp_int_t rel = dest - as->code_offset;
if (dest != -1 && rel < 0) {
if (dest != (mp_uint_t)-1 && rel < 0) {
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 8 bit relative jump
rel -= 2;
@@ -437,7 +437,7 @@ void asm_x86_jmp_label(asm_x86_t *as, mp_uint_t label) {
void asm_x86_jcc_label(asm_x86_t *as, mp_uint_t jcc_type, mp_uint_t label) {
mp_uint_t dest = get_label_dest(as, label);
mp_int_t rel = dest - as->code_offset;
if (dest != -1 && rel < 0) {
if (dest != (mp_uint_t)-1 && rel < 0) {
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 8 bit relative jump
rel -= 2;