Commit c52cba07 authored by bsheedy's avatar bsheedy Committed by Commit Bot

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: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50094}
parent 741213d6
...@@ -3693,7 +3693,7 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr, ...@@ -3693,7 +3693,7 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
vm_index = (vm_index << 1) | instr->NEONM(); vm_index = (vm_index << 1) | instr->NEONM();
} }
AppendToOutput("%d", vm_index); AppendToOutput("%d", vm_index);
return strlen("IVByElemIndex"); return static_cast<int>(strlen("IVByElemIndex"));
} }
case 'I': { // INS element. case 'I': { // INS element.
if (strncmp(format, "IVInsIndex", strlen("IVInsIndex")) == 0) { if (strncmp(format, "IVInsIndex", strlen("IVInsIndex")) == 0) {
...@@ -3706,11 +3706,11 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr, ...@@ -3706,11 +3706,11 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
rn_index = imm4 >> tz; rn_index = imm4 >> tz;
if (strncmp(format, "IVInsIndex1", strlen("IVInsIndex1")) == 0) { if (strncmp(format, "IVInsIndex1", strlen("IVInsIndex1")) == 0) {
AppendToOutput("%d", rd_index); AppendToOutput("%d", rd_index);
return strlen("IVInsIndex1"); return static_cast<int>(strlen("IVInsIndex1"));
} else if (strncmp(format, "IVInsIndex2", } else if (strncmp(format, "IVInsIndex2",
strlen("IVInsIndex2")) == 0) { strlen("IVInsIndex2")) == 0) {
AppendToOutput("%d", rn_index); AppendToOutput("%d", rn_index);
return strlen("IVInsIndex2"); return static_cast<int>(strlen("IVInsIndex2"));
} }
} }
return 0; return 0;
...@@ -3725,16 +3725,16 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr, ...@@ -3725,16 +3725,16 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
0) { 0) {
AppendToOutput("#0x%" PRIx32 " (%.4f)", instr->ImmNEONabcdefgh(), AppendToOutput("#0x%" PRIx32 " (%.4f)", instr->ImmNEONabcdefgh(),
instr->ImmNEONFP32()); instr->ImmNEONFP32());
return strlen("IVMIImmFPSingle"); return static_cast<int>(strlen("IVMIImmFPSingle"));
} else if (strncmp(format, "IVMIImmFPDouble", } else if (strncmp(format, "IVMIImmFPDouble",
strlen("IVMIImmFPDouble")) == 0) { strlen("IVMIImmFPDouble")) == 0) {
AppendToOutput("#0x%" PRIx32 " (%.4f)", instr->ImmNEONabcdefgh(), AppendToOutput("#0x%" PRIx32 " (%.4f)", instr->ImmNEONabcdefgh(),
instr->ImmNEONFP64()); instr->ImmNEONFP64());
return strlen("IVMIImmFPDouble"); return static_cast<int>(strlen("IVMIImmFPDouble"));
} else if (strncmp(format, "IVMIImm8", strlen("IVMIImm8")) == 0) { } else if (strncmp(format, "IVMIImm8", strlen("IVMIImm8")) == 0) {
uint64_t imm8 = instr->ImmNEONabcdefgh(); uint64_t imm8 = instr->ImmNEONabcdefgh();
AppendToOutput("#0x%" PRIx64, imm8); AppendToOutput("#0x%" PRIx64, imm8);
return strlen("IVMIImm8"); return static_cast<int>(strlen("IVMIImm8"));
} else if (strncmp(format, "IVMIImm", strlen("IVMIImm")) == 0) { } else if (strncmp(format, "IVMIImm", strlen("IVMIImm")) == 0) {
uint64_t imm8 = instr->ImmNEONabcdefgh(); uint64_t imm8 = instr->ImmNEONabcdefgh();
uint64_t imm = 0; uint64_t imm = 0;
...@@ -3744,19 +3744,19 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr, ...@@ -3744,19 +3744,19 @@ int DisassemblingDecoder::SubstituteImmediateField(Instruction* instr,
} }
} }
AppendToOutput("#0x%" PRIx64, imm); AppendToOutput("#0x%" PRIx64, imm);
return strlen("IVMIImm"); return static_cast<int>(strlen("IVMIImm"));
} else if (strncmp(format, "IVMIShiftAmt1", } else if (strncmp(format, "IVMIShiftAmt1",
strlen("IVMIShiftAmt1")) == 0) { strlen("IVMIShiftAmt1")) == 0) {
int cmode = instr->NEONCmode(); int cmode = instr->NEONCmode();
int shift_amount = 8 * ((cmode >> 1) & 3); int shift_amount = 8 * ((cmode >> 1) & 3);
AppendToOutput("#%d", shift_amount); AppendToOutput("#%d", shift_amount);
return strlen("IVMIShiftAmt1"); return static_cast<int>(strlen("IVMIShiftAmt1"));
} else if (strncmp(format, "IVMIShiftAmt2", } else if (strncmp(format, "IVMIShiftAmt2",
strlen("IVMIShiftAmt2")) == 0) { strlen("IVMIShiftAmt2")) == 0) {
int cmode = instr->NEONCmode(); int cmode = instr->NEONCmode();
int shift_amount = 8 << (cmode & 1); int shift_amount = 8 << (cmode & 1);
AppendToOutput("#%d", shift_amount); AppendToOutput("#%d", shift_amount);
return strlen("IVMIShiftAmt2"); return static_cast<int>(strlen("IVMIShiftAmt2"));
} else { } else {
UNIMPLEMENTED(); UNIMPLEMENTED();
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment