1 /*
2  * Copyright 2021 Google Inc. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 @file:Suppress("NOTHING_TO_INLINE")
17 package com.google.flatbuffers.kotlin
18 
19 /**
20  * This implementation assumes that of native macOSX64 the byte order of the implementation is Little Endian.
21  */
22 
getUBytenull23 public actual inline fun ByteArray.getUByte(index: Int): UByte = getUByteAt(index)
24 public actual inline fun ByteArray.getShort(index: Int): Short = getShortAt(index)
25 public actual inline fun ByteArray.getUShort(index: Int): UShort = getUShortAt(index)
26 public actual inline fun ByteArray.getInt(index: Int): Int = getIntAt(index)
27 public actual inline fun ByteArray.getUInt(index: Int): UInt = getUIntAt(index)
28 public actual inline fun ByteArray.getLong(index: Int): Long = getLongAt(index)
29 public actual inline fun ByteArray.getULong(index: Int): ULong = getULongAt(index)
30 
31 public actual inline fun ByteArray.setUByte(index: Int, value: UByte): Unit = setUByteAt(index, value)
32 public actual inline fun ByteArray.setShort(index: Int, value: Short): Unit = setShortAt(index, value)
33 public actual inline fun ByteArray.setUShort(index: Int, value: UShort): Unit = setUShortAt(index, value)
34 public actual inline fun ByteArray.setInt(index: Int, value: Int): Unit = setIntAt(index, value)
35 public actual inline fun ByteArray.setUInt(index: Int, value: UInt): Unit = setUIntAt(index, value)
36 public actual inline fun ByteArray.setLong(index: Int, value: Long): Unit = setLongAt(index, value)
37 public actual inline fun ByteArray.setULong(index: Int, value: ULong): Unit = setULongAt(index, value)
38 public actual inline fun ByteArray.setFloat(index: Int, value: Float): Unit = setFloatAt(index, value)
39 public actual inline fun ByteArray.setDouble(index: Int, value: Double): Unit = setDoubleAt(index, value)
40 public actual inline fun ByteArray.getFloat(index: Int): Float = Float.fromBits(getIntAt(index))
41 public actual inline fun ByteArray.getDouble(index: Int): Double = Double.fromBits(getLongAt(index))
42