|
From: Florian K. <fl...@ei...> - 2014-07-22 09:44:32
|
On 22.07.2014 11:27, sv...@va... wrote:
>
> +static IROp mkVecQDMULHIS ( UInt size ) {
> + const IROp ops[4]
> + = { Iop_INVALID, Iop_QDMulHi16Sx8, Iop_QDMulHi32Sx4, Iop_INVALID };
> + vassert(size < 4);
> + return ops[size];
> +}
If it's possible that more IROps are added here in the future, then the
following would be better as it wouldn't need adjustment of the magic
constant 4:
const IROp ops[] // let the compiler figure out # elements
= { Iop_INVALID, Iop_QDMulHi16Sx8, Iop_QDMulHi32Sx4, Iop_INVALID };
vassert(size < sizeof ops);
I also noticed that at the call site a return value of Iop_INVALID would
cause an IRExpr of that kind to be created which would cause some
indigestion downstream. Perhaps that value should not be returned here ?
> +
> +static IROp mkVecQRDMULHIS ( UInt size ) {
> + const IROp ops[4]
> + = { Iop_INVALID, Iop_QRDMulHi16Sx8, Iop_QRDMulHi32Sx4, Iop_INVALID };
> + vassert(size < 4);
> + return ops[size];
Likewise.
Florian
|