Moved NativePtr from interop to konan.internal
This commit is contained in:
@@ -89,8 +89,7 @@ abstract internal class CoroutineImpl(
|
||||
|
||||
// label == -1 when coroutine cannot be started (it is just a factory object) or has already finished execution
|
||||
// label == 0 in initial part of the coroutine
|
||||
// TODO: use IntPtr.
|
||||
protected var label: Long = if (completion != null) 0L else -1L
|
||||
protected var label: NativePtr = if (completion != null) NativePtr.NULL else NativePtr.NULL + (-1L)
|
||||
|
||||
private val _context: CoroutineContext? = completion?.context
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package konan.internal
|
||||
|
||||
@Intrinsic external fun getNativeNullPtr(): NativePtr
|
||||
|
||||
class NativePtr private constructor() {
|
||||
companion object {
|
||||
val NULL = getNativeNullPtr()
|
||||
}
|
||||
|
||||
@Intrinsic external operator fun plus(offset: Long): NativePtr
|
||||
|
||||
@Intrinsic external fun toLong(): Long
|
||||
|
||||
override fun equals(other: Any?) = (other is NativePtr) && konan.internal.areEqualByValue(this, other)
|
||||
|
||||
override fun hashCode() = this.toLong().hashCode()
|
||||
|
||||
override fun toString() = "0x${this.toLong().toString(16)}"
|
||||
}
|
||||
Reference in New Issue
Block a user