Add distinct bound permissivity for low and high
This commit is contained in:
parent
4dc429a572
commit
73608d2091
2 changed files with 12 additions and 10 deletions
|
|
@ -51,12 +51,14 @@ enum OpcodeFlags : int {
|
|||
kEnforceLowerBound = 1 << 1,
|
||||
kEnforceUpperBound = 1 << 2,
|
||||
kEnforceBounds = kEnforceLowerBound|kEnforceUpperBound,
|
||||
kPermissiveBounds = 1 << 3,
|
||||
kNormalizePercent = 1 << 4,
|
||||
kNormalizeMidi = 1 << 5,
|
||||
kNormalizeBend = 1 << 6,
|
||||
kWrapPhase = 1 << 7,
|
||||
kDb2Mag = 1 << 8,
|
||||
kPermissiveLowerBound = 1 << 3,
|
||||
kPermissiveUpperBound = 1 << 4,
|
||||
kPermissiveBounds = kPermissiveLowerBound|kPermissiveUpperBound,
|
||||
kNormalizePercent = 1 << 5,
|
||||
kNormalizeMidi = 1 << 6,
|
||||
kNormalizeBend = 1 << 7,
|
||||
kWrapPhase = 1 << 8,
|
||||
kDb2Mag = 1 << 9,
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
|
|
|||
|
|
@ -167,12 +167,12 @@ absl::optional<T> readInt_(OpcodeSpec<T> spec, absl::string_view v)
|
|||
if (returnedValue > static_cast<int64_t>(spec.bounds.getEnd())) {
|
||||
if (spec.flags & kEnforceUpperBound)
|
||||
return spec.bounds.getEnd();
|
||||
else if (!(spec.flags & kPermissiveBounds))
|
||||
else if (!(spec.flags & kPermissiveUpperBound))
|
||||
return absl::nullopt;
|
||||
} else if (returnedValue < static_cast<int64_t>(spec.bounds.getStart())) {
|
||||
if (spec.flags & kEnforceLowerBound)
|
||||
return spec.bounds.getStart();
|
||||
else if (!(spec.flags & kPermissiveBounds))
|
||||
else if (!(spec.flags & kPermissiveLowerBound))
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
|
|
@ -225,12 +225,12 @@ absl::optional<T> readFloat_(OpcodeSpec<T> spec, absl::string_view v)
|
|||
else if (returnedValue > static_cast<int64_t>(spec.bounds.getEnd())) {
|
||||
if (spec.flags & kEnforceUpperBound)
|
||||
return spec.bounds.getEnd();
|
||||
else if (!(spec.flags & kPermissiveBounds))
|
||||
else if (!(spec.flags & kPermissiveUpperBound))
|
||||
return absl::nullopt;
|
||||
} else if (returnedValue < static_cast<int64_t>(spec.bounds.getStart())) {
|
||||
if (spec.flags & kEnforceLowerBound)
|
||||
return spec.bounds.getStart();
|
||||
else if (!(spec.flags & kPermissiveBounds))
|
||||
else if (!(spec.flags & kPermissiveLowerBound))
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue