initial commits

master
Charles Iliya Krempeaux 2023-10-28 11:57:50 -07:00
parent d3a413c214
commit e6846604bb
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package hexadecabytes
import (
"sourcecode.social/reiver/go-hexadeca/symbols/byte"
)
func EncodeInt32(value int32, symbolFunc func(byte)byte) (r7 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
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 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
return EncodeInt32(value, bytesymbols.LowerCase)
}
func EncodeInt32UsingUpperCaseSymbols(value int32) (r7 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
return EncodeInt32(value, bytesymbols.UpperCase)
}

18
encodeint32.go 100644
View File

@ -0,0 +1,18 @@
package hexadeca
import (
"sourcecode.social/reiver/go-hexadeca/bytes"
"sourcecode.social/reiver/go-hexadeca/runes"
)
func EncodeInt32UsingLowerCaseSymbols(value int32) (r7 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
return hexadecabytes.EncodeInt32UsingLowerCaseSymbols(value)
}
func EncodeInt32UsingPersianSymbols(value int32) (r7 rune, r6 rune, r5 rune, r4 rune, r3 rune, r2 rune, r1 rune, r0 rune) {
return hexadecarunes.EncodeInt32UsingPersianSymbols(value)
}
func EncodeInt32UsingUpperCaseSymbols(value int32) (r7 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
return hexadecabytes.EncodeInt32UsingUpperCaseSymbols(value)
}

View File

@ -0,0 +1,26 @@
package hexadecarunes
import (
"sourcecode.social/reiver/go-hexadeca/symbols/rune"
)
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)
}