mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
|
#include <nx/KernelCapabilityEntry.h>
|
||
|
|
||
|
nx::KernelCapabilityEntry::KernelCapabilityEntry() :
|
||
|
mType(kc::KC_INVALID)
|
||
|
{}
|
||
|
|
||
|
nx::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type) :
|
||
|
mType(type),
|
||
|
mField(0)
|
||
|
{}
|
||
|
|
||
|
nx::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type, uint32_t field) :
|
||
|
mType(type),
|
||
|
mField(field)
|
||
|
{}
|
||
|
|
||
|
void nx::KernelCapabilityEntry::operator=(const KernelCapabilityEntry & other)
|
||
|
{
|
||
|
mType = other.mType;
|
||
|
mField = other.mField;
|
||
|
}
|
||
|
|
||
|
bool nx::KernelCapabilityEntry::operator==(const KernelCapabilityEntry & other) const
|
||
|
{
|
||
|
return (mType == other.mType) \
|
||
|
&& (mField == other.mField);
|
||
|
}
|
||
|
|
||
|
bool nx::KernelCapabilityEntry::operator!=(const KernelCapabilityEntry & other) const
|
||
|
{
|
||
|
return !operator==(other);
|
||
|
}
|
||
|
|
||
|
uint32_t nx::KernelCapabilityEntry::getCap() const
|
||
|
{
|
||
|
return (mField & getFieldMask()) << getFieldShift() | getCapMask();
|
||
|
}
|
||
|
|
||
|
void nx::KernelCapabilityEntry::setCap(uint32_t cap)
|
||
|
{
|
||
|
mType = getCapId(cap);
|
||
|
mField = (cap >> getFieldShift()) & getFieldMask();
|
||
|
}
|
||
|
|
||
|
nx::kc::KernelCapId nx::KernelCapabilityEntry::getType() const
|
||
|
{
|
||
|
return mType;
|
||
|
}
|
||
|
|
||
|
void nx::KernelCapabilityEntry::setType(kc::KernelCapId type)
|
||
|
{
|
||
|
mType = type;
|
||
|
}
|
||
|
|
||
|
uint32_t nx::KernelCapabilityEntry::getField() const
|
||
|
{
|
||
|
return mField & getFieldMask();
|
||
|
}
|
||
|
|
||
|
void nx::KernelCapabilityEntry::setField(uint32_t field)
|
||
|
{
|
||
|
mField = field;
|
||
|
}
|