WinDef.DWORD getLow() & getHigh() using incorrect bit mask #128

Closed
martin-woolstenhulme opened this Issue Sep 27, 2012 · 3 comments

Projects

None yet

3 participants

@martin-woolstenhulme

These two methods are using 0xFF as the bit mask when they should be using 0xFFFF. Each method returns a WORD, which is a 16-bit value. By using 0xFF only the lower byte is preserved.

New Code:

public WORD getLow() {
    return new WORD(longValue() & 0xFFFF);
}

public WORD getHigh() {
    return new WORD((longValue() >> 16) & 0xFFFF);
}

Old Code:

public WORD getLow() {
    return new WORD(longValue() & 0xFF);
}

public WORD getHigh() {
    return new WORD((longValue() >> 16) & 0xFF);
}
@dblock
Member
dblock commented Sep 27, 2012

Can you please make a pull request with tests. Appreciated.

@martin-woolstenhulme

I'm new here and I haven't done a pull request before. Are there instructions for that? I do know the basics of Git, so I think I can get by with just the general steps.

@dblock
Member
dblock commented Sep 27, 2012

Read Github Pull Requests.

For general contributing guidelines check out contributing to JNA.

@twall twall closed this in 245eb88 Oct 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment