This file contains various functions that are used by a variety of other stream components.
Component Summary | |
int->int
|
Saturation
Saturates a stream of integers, forcing them to lie within a specified range. |
int->int
|
BoundedSaturation
Saturates a stream of integers known to lie within some larger range, forcing them to lie within a specified range. |
int->int
|
DivideBy
Divide every value in the stream by a given number, truncating to the nearest integer. |
Component Detail |
int->int Saturation(int min, int max)
<int>
- A stream of integers.
<int>
- A stream of integers lying between min and max, inclusive. min
- The minimum value any integer in the stream is allowed to assume.
max
- The maximum value any integer in the stream is allowed to assume.
int->int BoundedSaturation(int min, int max, int worst_input_min, int worst_input_max)
<int>
- A stream of integers.
<int>
- A stream of integers lying between min and max, inclusive. min
- The minimum value any integer in the stream is allowed to assume.
max
- The maximum value any integer in the stream is allowed to assume.
worst_input_min
- The absolute minimum value any input could ever take on.
worst_input_max
- The absolute maximum value any input could ever take on.
int->int DivideBy(int div)
<int>
- An integer
<int>
- An integer related to the input by output = floor(input / div) div
- The denominator in the division.