go-hexadeca/encodeint64.go

32 lines
1.9 KiB
Go
Raw Normal View History

2023-10-27 07:58:13 +00:00
package hexadeca
2023-10-27 18:58:14 +00:00
import (
2023-10-27 20:25:50 +00:00
"sourcecode.social/reiver/go-hexadeca/enc/runes"
2023-10-27 18:58:14 +00:00
"sourcecode.social/reiver/go-hexadeca/symbols/rune"
)
2023-10-27 07:58:13 +00:00
func EncodeInt64(value int64, symbolFunc func(byte)rune) (r15 rune, r14 rune, r13 rune, r12 rune, r11 rune, r10 rune, r9 rune, r8 rune, r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
2023-10-27 20:25:50 +00:00
r15, r14 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 7))), symbolFunc)
r13, r12 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 6))), symbolFunc)
r11, r10 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 5))), symbolFunc)
r9, r8 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 4))), symbolFunc)
r7, r6 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 3))), symbolFunc)
r5, r4 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 2))), symbolFunc)
r3, r2 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 ))), symbolFunc)
r1, r0 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & value ), symbolFunc)
2023-10-27 07:58:13 +00:00
return
}
func EncodeInt64UsingLowerCaseSymbols(value int64) (r15 rune, r14 rune, r13 rune, r12 rune, r11 rune, r10 rune, r9 rune, r8 rune, r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
2023-10-27 18:58:14 +00:00
return EncodeInt64(value, runesymbols.LowerCase)
2023-10-27 07:58:13 +00:00
}
func EncodeInt64UsingPersianSymbols(value int64) (r15 rune, r14 rune, r13 rune, r12 rune, r11 rune, r10 rune, r9 rune, r8 rune, r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
2023-10-27 18:58:14 +00:00
return EncodeInt64(value, runesymbols.Persian)
2023-10-27 07:58:13 +00:00
}
func EncodeInt64UsingUpperCaseSymbols(value int64) (r15 rune, r14 rune, r13 rune, r12 rune, r11 rune, r10 rune, r9 rune, r8 rune, r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
2023-10-27 18:58:14 +00:00
return EncodeInt64(value, runesymbols.UpperCase)
2023-10-27 07:58:13 +00:00
}