-
Notifications
You must be signed in to change notification settings - Fork 157
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
Fix number to boolean conversion #138
base: master
Are you sure you want to change the base?
Conversation
If LongLong is converted to boolean, result must be true when the value is greater than 0x1_00_00_00_00
@headius how can I see what's wrong with the test? Works for me. |
There is a problem with x86asm. |
The two assembler stub compulers (for x32 and x64) declare that native method returns I feel pain looking at the assebler instructions and don't understand the code yet, so I need help! |
x64 problem part jnr-ffi/src/main/java/jnr/ffi/provider/jffi/X86_64StubCompiler.java Lines 251 to 350 in 1deb47d
|
x32 problem part jnr-ffi/src/main/java/jnr/ffi/provider/jffi/X86_32StubCompiler.java Lines 175 to 290 in 1deb47d
|
What should these conversions be? jnr-ffi/src/main/java/jnr/ffi/Struct.java Lines 780 to 792 in 96b3921
jnr-ffi/src/main/java/jnr/ffi/Struct.java Lines 797 to 809 in 96b3921
jnr-ffi/src/main/java/jnr/ffi/Struct.java Lines 811 to 823 in 96b3921
IMO, boolean is evaluated to false only if its integer value is zero. |
Yes, you are right. Regular boolean parameters are converted the way you mentioned. I think, this should be changed. |
jnr-ffi/src/main/java/jnr/ffi/provider/jffi/AsmLibraryLoader.java Lines 311 to 315 in a874103
|
also fixes #123