nstool/lib/libhac/source/KernelCapabilityEntry.cpp

64 lines
1.4 KiB
C++
Raw Permalink Normal View History

2018-08-07 07:17:51 +00:00
#include <nn/hac/KernelCapabilityEntry.h>
2018-08-07 07:17:51 +00:00
nn::hac::KernelCapabilityEntry::KernelCapabilityEntry() :
mType(kc::KC_INVALID)
{}
2018-08-07 07:17:51 +00:00
nn::hac::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type) :
mType(type),
mField(0)
{}
2018-08-07 07:17:51 +00:00
nn::hac::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type, uint32_t field) :
mType(type),
mField(field)
{}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelCapabilityEntry::operator=(const KernelCapabilityEntry & other)
{
mType = other.mType;
mField = other.mField;
}
2018-08-07 07:17:51 +00:00
bool nn::hac::KernelCapabilityEntry::operator==(const KernelCapabilityEntry & other) const
{
return (mType == other.mType) \
&& (mField == other.mField);
}
2018-08-07 07:17:51 +00:00
bool nn::hac::KernelCapabilityEntry::operator!=(const KernelCapabilityEntry & other) const
{
return !operator==(other);
}
2018-08-07 07:17:51 +00:00
uint32_t nn::hac::KernelCapabilityEntry::getCap() const
{
return (mField & getFieldMask()) << getFieldShift() | getCapMask();
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelCapabilityEntry::setCap(uint32_t cap)
{
mType = getCapId(cap);
mField = (cap >> getFieldShift()) & getFieldMask();
}
2018-08-07 07:17:51 +00:00
nn::hac::kc::KernelCapId nn::hac::KernelCapabilityEntry::getType() const
{
return mType;
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelCapabilityEntry::setType(kc::KernelCapId type)
{
mType = type;
}
2018-08-07 07:17:51 +00:00
uint32_t nn::hac::KernelCapabilityEntry::getField() const
{
return mField & getFieldMask();
}
2018-08-07 07:17:51 +00:00
void nn::hac::KernelCapabilityEntry::setField(uint32_t field)
{
mField = field;
}