json_sjs1_3.4.0.2.source-code.ToDecimalByte.scala Maven / Gradle / Ivy
package ujson
object MathUtilsByte{
def toString(bytes: Array[Byte], index: Int, s: String) = {
val len = s.length
var i = 0
while (i < len) {
bytes(index + i) = s.charAt(i).toByte
i += 1
}
len
}
}
object DoubleToDecimalByte{
def toString(bytes: Array[Byte], index: Int, v: Double) = {
MathUtilsByte.toString(bytes, index, v.toString)
}
}
object FloatToDecimalByte{
def toString(bytes: Array[Byte], index: Int, v: Float) = {
MathUtilsByte.toString(bytes, index, v.toString)
}
}