-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersoptimization
Description
Currently there are a bunch of boolean values in the ProbabilityState class which could be condensed into something smaller:
class ProbabilityState {
public:
...
bool assignedInRemapping;
bool isNew;
bool wasPutInTerminalQueue;
bool preTerminated;
bool deadlock;
...
// More code here
}We could use a single uint8_t status to hold all of these values, with bit 0 being assignedInRemapping, bit 1 being isNew, etc... and use bitwise math to get the values like so:
// Somewhere Above
const uint8_t ASSIGNED_IN_REMAPPING_INDEX = 0;
const uint8_t IS_NEW_INDEX = 1;
...
void
ProbabilityState::setAssignedInRemapping(bool value) {
// Create bitmask and zero out the desired bit
status &= ~(0x1 << ASSIGNED_IN_REMAPPING_INDEX);
// Set the desired bit to the desired value
status |= (uint8_t) value << ASSIGNED_IN_REMAPPING_INDEX;
}
bool
ProbabilityState::wasAssignedInRemapping() {
return (status >> ASSIGNED_IN_REMAPPING_INDEX) & 0x1;
}If anyone wants to help out on this, I think this would be a good first issue for a newcomer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersoptimization