Fix implicit conversions in disasm-arm64.cc

Adds static_cast<int> to a number of return values in disasm-arm64.cc.
The implicit conversion from size_t (unsigned long) to int was causing
compilation warnings/errors when upgrading to Android NDK r16.

Bug: chromium:771171
Change-Id: I9a5f80d65565e1a9ab4caf2cf874240f04f406a1
Reviewed-on: https://chromium-review.googlesource.com/826254
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50094}
This commit is contained in:
bsheedy 2017-12-13 16:10:05 -08:00 committed by Commit Bot
parent 741213d6ed
commit c52cba07ef

View File

@ -3693,7 +3693,7 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
vm_index = (vm_index << 1) | instr->NEONM();
}
AppendToOutput("%d", vm_index);
return strlen("IVByElemIndex");
return static_cast<int>(strlen("IVByElemIndex"));
}
case 'I': { // INS element.
if (strncmp(format, "IVInsIndex", strlen("IVInsIndex")) == 0) {
@ -3706,11 +3706,11 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
rn_index = imm4 >> tz;
if (strncmp(format, "IVInsIndex1", strlen("IVInsIndex1")) == 0) {
AppendToOutput("%d", rd_index);
return strlen("IVInsIndex1");
return static_cast<int>(strlen("IVInsIndex1"));
} else if (strncmp(format, "IVInsIndex2",
strlen("IVInsIndex2")) == 0) {
AppendToOutput("%d", rn_index);
return strlen("IVInsIndex2");
return static_cast<int>(strlen("IVInsIndex2"));
}
}
return 0;
@ -3725,16 +3725,16 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
0) {
AppendToOutput("#0x%" PRIx32 " (%.4f)", instr->ImmNEONabcdefgh(),
instr->ImmNEONFP32());
return strlen("IVMIImmFPSingle");
return static_cast<int>(strlen("IVMIImmFPSingle"));
} else if (strncmp(format, "IVMIImmFPDouble",
strlen("IVMIImmFPDouble")) == 0) {
AppendToOutput("#0x%" PRIx32 " (%.4f)", instr->ImmNEONabcdefgh(),
instr->ImmNEONFP64());
return strlen("IVMIImmFPDouble");
return static_cast<int>(strlen("IVMIImmFPDouble"));
} else if (strncmp(format, "IVMIImm8", strlen("IVMIImm8")) == 0) {
uint64_t imm8 = instr->ImmNEONabcdefgh();
AppendToOutput("#0x%" PRIx64, imm8);
return strlen("IVMIImm8");
return static_cast<int>(strlen("IVMIImm8"));
} else if (strncmp(format, "IVMIImm", strlen("IVMIImm")) == 0) {
uint64_t imm8 = instr->ImmNEONabcdefgh();
uint64_t imm = 0;
@ -3744,19 +3744,19 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
}
}
AppendToOutput("#0x%" PRIx64, imm);
return strlen("IVMIImm");
return static_cast<int>(strlen("IVMIImm"));
} else if (strncmp(format, "IVMIShiftAmt1",
strlen("IVMIShiftAmt1")) == 0) {
int cmode = instr->NEONCmode();
int shift_amount = 8 * ((cmode >> 1) & 3);
AppendToOutput("#%d", shift_amount);
return strlen("IVMIShiftAmt1");
return static_cast<int>(strlen("IVMIShiftAmt1"));
} else if (strncmp(format, "IVMIShiftAmt2",
strlen("IVMIShiftAmt2")) == 0) {
int cmode = instr->NEONCmode();
int shift_amount = 8 << (cmode & 1);
AppendToOutput("#%d", shift_amount);
return strlen("IVMIShiftAmt2");
return static_cast<int>(strlen("IVMIShiftAmt2"));
} else {
UNIMPLEMENTED();
return 0;