You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

224 lines
4.4 KiB

// Code generated by mkencint, DO NOT EDIT.
package jx
var digits []uint32
func init() {
digits = make([]uint32, 1000)
for i := uint32(0); i < 1000; i++ {
digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0'
if i < 10 {
digits[i] += 2 << 24
} else if i < 100 {
digits[i] += 1 << 24
}
}
}
func writeFirstBuf(space []byte, v uint32) []byte {
start := v >> 24
if start == 0 {
space = append(space, byte(v>>16), byte(v>>8))
} else if start == 1 {
space = append(space, byte(v>>8))
}
space = append(space, byte(v))
return space
}
func writeBuf(buf []byte, v uint32) []byte {
return append(buf, byte(v>>16), byte(v>>8), byte(v))
}
// UInt64 encodes uint64.
func (w *Writer) UInt64(v uint64) {
q0 := v
// Iteration 0.
q1 := q0 / 1000
if q1 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q0])
return
}
// Iteration 1.
r1 := q0 - q1*1000
q2 := q1 / 1000
if q2 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q1])
w.Buf = writeBuf(w.Buf, digits[r1])
return
}
// Iteration 2.
r2 := q1 - q2*1000
q3 := q2 / 1000
if q3 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q2])
w.Buf = writeBuf(w.Buf, digits[r2])
w.Buf = writeBuf(w.Buf, digits[r1])
return
}
// Iteration 3.
r3 := q2 - q3*1000
q4 := q3 / 1000
if q4 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q3])
w.Buf = writeBuf(w.Buf, digits[r3])
w.Buf = writeBuf(w.Buf, digits[r2])
w.Buf = writeBuf(w.Buf, digits[r1])
return
}
// Iteration 4.
r4 := q3 - q4*1000
q5 := q4 / 1000
if q5 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q4])
w.Buf = writeBuf(w.Buf, digits[r4])
w.Buf = writeBuf(w.Buf, digits[r3])
w.Buf = writeBuf(w.Buf, digits[r2])
w.Buf = writeBuf(w.Buf, digits[r1])
return
}
// Iteration 5.
r5 := q4 - q5*1000
q6 := q5 / 1000
if q6 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q5])
w.Buf = writeBuf(w.Buf, digits[r5])
w.Buf = writeBuf(w.Buf, digits[r4])
w.Buf = writeBuf(w.Buf, digits[r3])
w.Buf = writeBuf(w.Buf, digits[r2])
w.Buf = writeBuf(w.Buf, digits[r1])
return
}
// Iteration 6.
r6 := q5 - q6*1000
w.Buf = writeFirstBuf(w.Buf, digits[q6])
w.Buf = writeBuf(w.Buf, digits[r6])
w.Buf = writeBuf(w.Buf, digits[r5])
w.Buf = writeBuf(w.Buf, digits[r4])
w.Buf = writeBuf(w.Buf, digits[r3])
w.Buf = writeBuf(w.Buf, digits[r2])
w.Buf = writeBuf(w.Buf, digits[r1])
}
// UInt64 encodes uint64.
func (e *Encoder) UInt64(v uint64) {
e.comma()
e.w.UInt64(v)
}
// Int64 encodes int64.
func (w *Writer) Int64(v int64) {
var val uint64
if v < 0 {
val = uint64(-v)
w.Buf = append(w.Buf, '-')
} else {
val = uint64(v)
}
w.UInt64(val)
}
// Int64 encodes int64.
func (e *Encoder) Int64(v int64) {
e.comma()
e.w.Int64(v)
}
// UInt32 encodes uint32.
func (w *Writer) UInt32(v uint32) {
q0 := v
// Iteration 0.
q1 := q0 / 1000
if q1 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q0])
return
}
// Iteration 1.
r1 := q0 - q1*1000
q2 := q1 / 1000
if q2 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q1])
w.Buf = writeBuf(w.Buf, digits[r1])
return
}
// Iteration 2.
r2 := q1 - q2*1000
q3 := q2 / 1000
if q3 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q2])
w.Buf = writeBuf(w.Buf, digits[r2])
w.Buf = writeBuf(w.Buf, digits[r1])
return
}
// Iteration 3.
r3 := q2 - q3*1000
w.Buf = writeFirstBuf(w.Buf, digits[q3])
w.Buf = writeBuf(w.Buf, digits[r3])
w.Buf = writeBuf(w.Buf, digits[r2])
w.Buf = writeBuf(w.Buf, digits[r1])
}
// UInt32 encodes uint32.
func (e *Encoder) UInt32(v uint32) {
e.comma()
e.w.UInt32(v)
}
// Int32 encodes int32.
func (w *Writer) Int32(v int32) {
var val uint32
if v < 0 {
val = uint32(-v)
w.Buf = append(w.Buf, '-')
} else {
val = uint32(v)
}
w.UInt32(val)
}
// Int32 encodes int32.
func (e *Encoder) Int32(v int32) {
e.comma()
e.w.Int32(v)
}
// UInt16 encodes uint16.
func (w *Writer) UInt16(v uint16) {
q0 := v
// Iteration 0.
q1 := q0 / 1000
if q1 == 0 {
w.Buf = writeFirstBuf(w.Buf, digits[q0])
return
}
// Iteration 1.
r1 := q0 - q1*1000
w.Buf = writeFirstBuf(w.Buf, digits[q1])
w.Buf = writeBuf(w.Buf, digits[r1])
}
// UInt16 encodes uint16.
func (e *Encoder) UInt16(v uint16) {
e.comma()
e.w.UInt16(v)
}
// Int16 encodes int16.
func (w *Writer) Int16(v int16) {
var val uint16
if v < 0 {
val = uint16(-v)
w.Buf = append(w.Buf, '-')
} else {
val = uint16(v)
}
w.UInt16(val)
}
// Int16 encodes int16.
func (e *Encoder) Int16(v int16) {
e.comma()
e.w.Int16(v)
}