Skip to content

Commit 867a1eb

Browse files
committed
Change rescaleInput function definition
Makes the function static and changes both Range arguments to pass by const reference rather than copy, as the function does not need to (and shouldn't!) modify the input ranges.
1 parent 1bc0123 commit 867a1eb

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/XInput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ XInputController::Range * XInputController::getRangeFromEnum(XInputControl ctrl)
514514
}
515515
}
516516

517-
int32_t XInputController::rescaleInput(int32_t val, Range in, Range out) {
517+
int32_t XInputController::rescaleInput(int32_t val, const Range& in, const Range& out) {
518518
if (val <= in.min) return out.min; // Out of range -
519519
if (val >= in.max) return out.max; // Out of range +
520520
if (in.min == out.min && in.max == out.max) return val; // Ranges identical

src/XInput.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class XInputController {
161161
// Control Input Ranges
162162
Range rangeTrigLeft, rangeTrigRight, rangeJoyLeft, rangeJoyRight;
163163
Range * getRangeFromEnum(XInputControl ctrl);
164-
int32_t rescaleInput(int32_t val, Range in, Range out);
164+
static int32_t rescaleInput(int32_t val, const Range& in, const Range &out);
165165
};
166166

167167
extern XInputController XInput;

0 commit comments

Comments
 (0)