-
Notifications
You must be signed in to change notification settings - Fork 59
Handling unsigned numbers better in jextract #333
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
Conversation
4b92e65
to
e998244
Compare
/// Specifically negative values of a `@Unchecked long` must be interpreted carefully as | ||
/// a value larger than the Long.MAX_VALUE can represent in Java. You can use `org.swift.swiftkit.core.primitives` | ||
/// utility classes to work with such unsigned values in Java. | ||
case annotate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's our default mode, it's also similar to what OpenJDK jextract does (we add the annotation, jextract itself does nothing)
@Unsigned | ||
public static int unsignedLong(@Unsigned long first, @Unsigned int second) { | ||
return swiftjava_SwiftModule_unsignedLong_first_second.call(first, second); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,69 @@ | |||
//===----------------------------------------------------------------------===// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the primitives types are vendored Guava types.
TBD if we'd like to may be just roll our own entirely or just make jextract emit code which assumes you'll bring your own Guava perhaps...
I'm still on the fence about the I'm gonna sleep over this change and decide that to do about the guava types -- perhaps remove them for now, until we truly want them after all. |
This reverts commit c7499cc.
Resolves #307
This introduces
@Unsigned long
and friends importing as well as an opt-in mode to import unsigned types as Guava'sUnsignedInteger
and friends which is only available for FFM right now.