Fix NSUInteger size for Watchos x64

This commit is contained in:
Pavel Punegov
2020-12-24 15:50:56 +03:00
committed by Nikolay Krasko
parent 6cc60ad6a2
commit e241d1249c
2 changed files with 8 additions and 19 deletions
@@ -67,11 +67,12 @@ fun run() {
// hashCode (directly):
// hash() returns value of NSUInteger type.
val hash = when (Platform.osFamily) {
val hash = if (Platform.osFamily == OsFamily.WATCHOS && Platform.cpuArchitecture.bitness == 32) {
// `typedef unsigned int NSInteger` on watchOS.
OsFamily.WATCHOS -> foo.hash().toInt()
foo.hash().toInt()
} else {
// `typedef unsigned long NSUInteger` on iOS, macOS, tvOS.
else -> foo.hash().let { it.toInt() xor (it shr 32).toInt() }
foo.hash().let { it.toInt() xor (it shr 32).toInt() }
}
if (foo.hashCode() == hash) {
// toString (virtually):