March 31, 2026
12:16 p.m.
Matteo Bruni (@Mystral) commented about dlls/dsound/mixer.c:
int opos = (int)(opos_num >> 32) - fir_width;
UINT idx = ~(DWORD)opos_num >> (32 - fir_step_shift) << fir_width_shift; - UINT rem_num = ~(DWORD)opos_num << fir_step_shift; - float rem = rem_num * (1.0f / (1ll << 32)); + int rem_num = ~(DWORD)opos_num << fir_step_shift >> 1; + float rem = rem_num * (1.0f / (1ll << 31));
Smart! I'd have `#define`s for these conversion numbers as well, maybe something like: ``` #define POS_FRAC_TO_SIGNED_SHIFT 1 #define POS_FRAC_SIGNED_MAX (1ll << 31) ``` I expect the resulting code to be more verbose but also quite a bit more self-explanatory. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10423#note_134506