Fix ArgList::operator[]

This commit is contained in:
Victor Zverovich 2014-09-25 09:31:36 -07:00
parent b2bd63d2d9
commit a9da3d3852

View File

@ -897,13 +897,15 @@ class ArgList {
*/ */
internal::Arg operator[](unsigned index) const { internal::Arg operator[](unsigned index) const {
using internal::Arg; using internal::Arg;
if (index >= MAX_ARGS) Arg arg;
return Arg(); if (index >= MAX_ARGS) {
arg.type = Arg::NONE;
return arg;
}
unsigned shift = index * 4; unsigned shift = index * 4;
uint64_t mask = 0xf; uint64_t mask = 0xf;
Arg::Type type = Arg::Type type =
static_cast<Arg::Type>((types_ & (mask << shift)) >> shift); static_cast<Arg::Type>((types_ & (mask << shift)) >> shift);
Arg arg;
arg.type = type; arg.type = type;
if (type != Arg::NONE) { if (type != Arg::NONE) {
internal::Value &value = arg; internal::Value &value = arg;