mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01:00
[RISCV] Replace incorrect use of sizeof with array_lengthof
RISCVDisassembler was incorrectly using sizeof(Arr) when it should have used sizeof(Arr)/sizeof(Arr[0]). Update to use array_lengthof instead. llvm-svn: 356035
This commit is contained in:
parent
08fd1ff105
commit
ba45169928
@ -69,7 +69,7 @@ static const unsigned GPRDecoderTable[] = {
|
|||||||
static DecodeStatus DecodeGPRRegisterClass(MCInst &Inst, uint64_t RegNo,
|
static DecodeStatus DecodeGPRRegisterClass(MCInst &Inst, uint64_t RegNo,
|
||||||
uint64_t Address,
|
uint64_t Address,
|
||||||
const void *Decoder) {
|
const void *Decoder) {
|
||||||
if (RegNo > sizeof(GPRDecoderTable))
|
if (RegNo > array_lengthof(GPRDecoderTable))
|
||||||
return MCDisassembler::Fail;
|
return MCDisassembler::Fail;
|
||||||
|
|
||||||
// We must define our own mapping from RegNo to register identifier.
|
// We must define our own mapping from RegNo to register identifier.
|
||||||
@ -94,7 +94,7 @@ static const unsigned FPR32DecoderTable[] = {
|
|||||||
static DecodeStatus DecodeFPR32RegisterClass(MCInst &Inst, uint64_t RegNo,
|
static DecodeStatus DecodeFPR32RegisterClass(MCInst &Inst, uint64_t RegNo,
|
||||||
uint64_t Address,
|
uint64_t Address,
|
||||||
const void *Decoder) {
|
const void *Decoder) {
|
||||||
if (RegNo > sizeof(FPR32DecoderTable))
|
if (RegNo > array_lengthof(FPR32DecoderTable))
|
||||||
return MCDisassembler::Fail;
|
return MCDisassembler::Fail;
|
||||||
|
|
||||||
// We must define our own mapping from RegNo to register identifier.
|
// We must define our own mapping from RegNo to register identifier.
|
||||||
@ -130,7 +130,7 @@ static const unsigned FPR64DecoderTable[] = {
|
|||||||
static DecodeStatus DecodeFPR64RegisterClass(MCInst &Inst, uint64_t RegNo,
|
static DecodeStatus DecodeFPR64RegisterClass(MCInst &Inst, uint64_t RegNo,
|
||||||
uint64_t Address,
|
uint64_t Address,
|
||||||
const void *Decoder) {
|
const void *Decoder) {
|
||||||
if (RegNo > sizeof(FPR64DecoderTable))
|
if (RegNo > array_lengthof(FPR64DecoderTable))
|
||||||
return MCDisassembler::Fail;
|
return MCDisassembler::Fail;
|
||||||
|
|
||||||
// We must define our own mapping from RegNo to register identifier.
|
// We must define our own mapping from RegNo to register identifier.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user