go-hexadeca/runes/encodeint32.go

27 lines
1.0 KiB
Go
Raw Permalink Normal View History

2023-10-28 18:57:50 +00:00
package hexadecarunes
import (
2024-07-25 11:33:45 +00:00
"github.com/reiver/go-hexadeca/symbols/rune"
2023-10-28 18:57:50 +00:00
)
func EncodeInt32(value int32, symbolFunc func(byte)rune) (r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
r7, r6 = EncodeByte(byte(0x000000ff & (value >> (8 * 3))), symbolFunc)
r5, r4 = EncodeByte(byte(0x000000ff & (value >> (8 * 2))), symbolFunc)
r3, r2 = EncodeByte(byte(0x000000ff & (value >> (8 ))), symbolFunc)
r1, r0 = EncodeByte(byte(0x000000ff & value ), symbolFunc)
return
}
func EncodeInt32UsingLowerCaseSymbols(value int32) (r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
return EncodeInt32(value, runesymbols.LowerCase)
}
func EncodeInt32UsingPersianSymbols(value int32) (r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
return EncodeInt32(value, runesymbols.Persian)
}
func EncodeInt32UsingUpperCaseSymbols(value int32) (r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
return EncodeInt32(value, runesymbols.UpperCase)
}