go-hexadeca/runes/encodeuint32.go

27 lines
1.1 KiB
Go
Raw Normal View History

2023-10-27 20:39:11 +00:00
package hexadecarunes
2023-10-27 08:01:34 +00:00
2023-10-27 18:58:14 +00:00
import (
2024-07-25 11:33:45 +00:00
"github.com/reiver/go-hexadeca/symbols/rune"
2023-10-27 18:58:14 +00:00
)
2023-10-27 08:01:34 +00:00
func EncodeUint32(value uint32, symbolFunc func(byte)rune) (r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
2023-10-27 20:39:11 +00:00
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)
2023-10-27 08:01:34 +00:00
return
}
func EncodeUint32UsingLowerCaseSymbols(value uint32) (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 EncodeUint32(value, runesymbols.LowerCase)
2023-10-27 08:01:34 +00:00
}
func EncodeUint32UsingPersianSymbols(value uint32) (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 EncodeUint32(value, runesymbols.Persian)
2023-10-27 08:01:34 +00:00
}
func EncodeUint32UsingUpperCaseSymbols(value uint32) (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 EncodeUint32(value, runesymbols.UpperCase)
2023-10-27 08:01:34 +00:00
}