Skip to content

Commit d5d51d2

Browse files
committed
Use static range for rescaling outputs
The pointer is always going to point to this anyways, may as well let the compiler optimize it if it can.
1 parent 9f7ce0d commit d5d51d2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/XInput.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void XInputController::setTrigger(XInputControl trigger, int32_t val) {
259259
const XInputMap_Trigger * triggerData = getTriggerFromEnum(trigger);
260260
if (triggerData == nullptr) return; // Not a trigger
261261

262-
val = rescaleInput(val, *getRangeFromEnum(trigger), triggerData->range);
262+
val = rescaleInput(val, *getRangeFromEnum(trigger), XInputMap_Trigger::range);
263263
if (getTrigger(trigger) == val) return; // Trigger hasn't changed
264264

265265
tx[triggerData->index] = val;
@@ -271,8 +271,8 @@ void XInputController::setJoystick(XInputControl joy, int32_t x, int32_t y) {
271271
const XInputMap_Joystick * joyData = getJoyFromEnum(joy);
272272
if (joyData == nullptr) return; // Not a joystick
273273

274-
x = rescaleInput(x, *getRangeFromEnum(joy), joyData->range);
275-
y = rescaleInput(y, *getRangeFromEnum(joy), joyData->range);
274+
x = rescaleInput(x, *getRangeFromEnum(joy), XInputMap_Joystick::range);
275+
y = rescaleInput(y, *getRangeFromEnum(joy), XInputMap_Joystick::range);
276276

277277
setJoystickDirect(joy, x, y);
278278
}

0 commit comments

Comments
 (0)