Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

@martin-woolstenhulme
Copy link

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
Copy link
Member

dblock commented Sep 27, 2012

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

@martin-woolstenhulme
Copy link
Author

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
Copy link
Member

dblock commented Sep 27, 2012

Read Github Pull Requests.

For general contributing guidelines check out contributing to JNA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants