diff options
| author | a1xd <[email protected]> | 2021-09-18 05:20:53 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-09-23 22:36:18 -0400 |
| commit | 115030165d539fde5440f6232879c7a076dea2ec (patch) | |
| tree | 89f50a3f38b6b9052fa5085e36a2d00577805e43 /common/rawaccel-validate.hpp | |
| parent | Add power start from one (diff) | |
| download | rawaccel-115030165d539fde5440f6232879c7a076dea2ec.tar.xz rawaccel-115030165d539fde5440f6232879c7a076dea2ec.zip | |
generalize power start-from-1
starting output is determined by (gain) offset
Diffstat (limited to 'common/rawaccel-validate.hpp')
| -rw-r--r-- | common/rawaccel-validate.hpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/common/rawaccel-validate.hpp b/common/rawaccel-validate.hpp index a88d514..23deb5f 100644 --- a/common/rawaccel-validate.hpp +++ b/common/rawaccel-validate.hpp @@ -50,16 +50,20 @@ namespace rawaccel { error("data size > max"); } - if (args.offset < 0) { + if (args.input_offset < 0) { error("offset can not be negative"); } - else if (args.mode == accel_mode::jump && args.offset == 0) { + else if (args.mode == accel_mode::jump && args.input_offset == 0) { error("offset can not be 0"); } + if (args.output_offset < 0) { + error("offset can not be negative"); + } + bool jump_or_io_cap = (args.mode == accel_mode::jump || - (args.mode == accel_mode::classic && + ((args.mode == accel_mode::classic || args.mode == accel_mode::power) && args.cap_mode == classic_cap_mode::io)); if (args.cap.x < 0) { @@ -76,6 +80,11 @@ namespace rawaccel { error("cap (output) can not be 0"); } + if (args.cap.x > 0 && args.cap.x < args.input_offset || + args.cap.y > 0 && args.cap.y < args.output_offset) { + error("cap < offset"); + } + if (args.growth_rate <= 0 || args.decay_rate <= 0 || args.acceleration <= 0) { |