-
Notifications
You must be signed in to change notification settings - Fork 564
Conversation
@@ -1091,11 +1104,15 @@ private fun objCFunctionType(context: Context, methodBridge: MethodBridge): LLVM | |||
|
|||
private val ObjCValueType.llvmType: LLVMTypeRef get() = when (this) { | |||
ObjCValueType.BOOL -> int8Type | |||
ObjCValueType.UNICHAR -> int16Type |
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.
Maybe make it map/array indexed by ObjCValueType ordinal?
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.
Kotlin compiler appears to optimize when
over enum entries.
@@ -237,6 +237,22 @@ external private fun copyImpl(array: IntArray, fromIndex: Int, | |||
external private fun copyImpl(array: LongArray, fromIndex: Int, | |||
destination: LongArray, toIndex: Int, count: Int) | |||
|
|||
@SymbolName("Kotlin_ByteArray_copyImpl") |
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.
Maybe add comment that operation is bitwise identical to signed types?
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.
Done
@@ -279,6 +295,30 @@ fun LongArray.copyRangeTo(destination: LongArray, fromIndex: Int, toIndex: Int, | |||
copyImpl(this, fromIndex, destination, destinationIndex, toIndex - fromIndex) | |||
} | |||
|
|||
@SinceKotlin("1.3") | |||
@ExperimentalUnsignedTypes |
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.
What's the point of this annotation?
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.
It is recommended to have one on any declaration that uses unsigned types. That's how Kotlin experimental features are organized.
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.
Not sure if it makes any sense for Native.
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.
I'm sure that it makes sense for Native.
public fun UByteArray.contentHashCode(): Int { | ||
var result = 1 | ||
for (element in this) | ||
result = 31 * result + element.hashCode() |
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.
Why call element.hashCode()
and not just element
?
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.
- Kotlin doesn't have mixed signed-unsigned operations.
- All other variants of this function call hashCode, including one for ints.
613ba2e
to
fb3ae01
Compare
(cherry picked from commit 7b46f93)
(cherry picked from commit 7b46f93)
(cherry picked from commit 7b46f93)
(cherry picked from commit 7b46f93)
(cherry picked from commit 7b46f93)
(cherry picked from commit 7b46f93)
To be merged after #1840 and updating to 1.3.
Migrating C interop to unsigned types is to be added later as a separate PR.