SHOW:
|
|
- or go back to the newest paste.
1 | void iopm_fillRange(BYTE pIopm[IOPM_SIZE], PORTRANGE* pRange) { | |
2 | - | |
2 | + | int i=pRange->first, iAmount=(pRange->last-i)+1; |
3 | - | DWORD i=pRange->first, iAmount=(pRange->last-i)+1; |
3 | + | DWORD *pdwIopm = (DWORD*)pIopm; |
4 | - | DWORD *pdwIopm = (DWORD*)pIopm; |
4 | + | |
5 | - | |
5 | + | #define __FillRange__(_OP,_V) \ |
6 | - | #define __FillRange__(_OP,_V) \ |
6 | + | DWORD dwMask = (((i|31)+1)-i)>iAmount?((DWORD)-1)>>((((i|31)+1)-i)-iAmount):-1; \ |
7 | - | if (i&31) { pdwIopm[i>>5] _OP (-1<<(i&31)); iAmount -= 32-(i&1) ; i = (i|31)+1; } \ |
7 | + | if (i&31) { pdwIopm[i>>5] _OP ((-1<<(i&31))&dwMask); iAmount -= 32-(i&1) ; i = (i|31)+1; } \ |
8 | - | for ( i>>=5 ; iAmount>31 ; iAmount-=32 ) pdwIopm[i++] = _V; \ |
8 | + | for ( i>>=5 ; iAmount>31 ; iAmount-=32 ) pdwIopm[i++] = _V; \ |
9 | - | if (iAmount) pdwIopm[i] _OP (((DWORD)-1)>>(32-iAmount)); |
9 | + | if (iAmount>0) pdwIopm[i] _OP (((DWORD)-1)>>(32-iAmount)); |
10 | - | |
10 | + | |
11 | - | if (!pRange->isEnabled) { __FillRange__(|=,-1); } else { __FillRange__(&=~,0); } |
11 | + | if (!pRange->isEnabled) { __FillRange__(|=,-1); } else { __FillRange__(&=~,0); } |
12 | ||
13 | } |