scoop:scoop.core:0.1.0
src/string_copies.scoop
Selected production source · src/string_copies.scoop
1
// Construction-only storage operations. The caller establishes byte bounds;2
// writes are confined to an unpublished result until valid UTF-8 is complete.3
@Intrinsic("string_allocate_zeroed")4
internal fun coreStringAllocateZeroed(length: Long): String6
@Unsafe @Intrinsic("string_byte_at_unchecked")7
internal fun coreStringByteAtUnchecked(value: String, index: Long): Byte9
@Unsafe @Intrinsic("string_set_byte_unchecked")10
internal fun coreStringSetByteUnchecked(value: String, index: Long, byte: Byte)12
@Unsafe13
@Intrinsic("string_copy_utf8_unchecked")14
internal fun coreStringCopyUtf8Unchecked(bytes: Ptr<Byte>, length: Long): String16
@Intrinsic("string_to_bytes")17
internal fun coreStringToBytes(value: String): Array<Byte>19
@Intrinsic("string_to_mutable_bytes")20
internal fun coreStringToMutableBytes(value: String): MutableArray<Byte>22
// The Char caller supplies one valid scalar. Encode it once into a GC-free23
// local place, then copy exactly the initialized bytes.24
internal fun coreCharToString(code: UInt): String {25
var storage = coreUtf8Word(code)26
@Unsafe {27
return coreStringCopyUtf8Unchecked(addressOf(storage).cast<Byte>(), coreUtf8Width(code))28
}29
}