initial commits

master
Charles Iliya Krempeaux 2023-10-28 12:02:30 -07:00
parent b6e6f5add4
commit f1c7f7809a
4 changed files with 63 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Package **hexadeca** has functions for hexadecimal encoding and decoding for the
* `uint16`,
* `uint32`
* `uint64`
* `int16`
* `int32`
* `int64`

View File

@ -0,0 +1,20 @@
package hexadecabytes
import (
"sourcecode.social/reiver/go-hexadeca/symbols/byte"
)
func EncodeInt16(value int16, symbolFunc func(byte)byte) (r3 byte, r2 byte, r1 byte, r0 byte) {
r3, r2 = EncodeByte(byte(0x00ff & (value >> (8 ))), symbolFunc)
r1, r0 = EncodeByte(byte(0x00ff & value ), symbolFunc)
return
}
func EncodeInt16UsingLowerCaseSymbols(value int16) (r3 byte, r2 byte, r1 byte, r0 byte) {
return EncodeInt16(value, bytesymbols.LowerCase)
}
func EncodeInt16UsingUpperCaseSymbols(value int16) (r3 byte, r2 byte, r1 byte, r0 byte) {
return EncodeInt16(value, bytesymbols.UpperCase)
}

18
encodeint16.go 100644
View File

@ -0,0 +1,18 @@
package hexadeca
import (
"sourcecode.social/reiver/go-hexadeca/bytes"
"sourcecode.social/reiver/go-hexadeca/runes"
)
func EncodeInt16UsingLowerCaseSymbols(value int16) (r3 byte, r2 byte, r1 byte, r0 byte) {
return hexadecabytes.EncodeInt16UsingLowerCaseSymbols(value)
}
func EncodeInt16UsingPersianSymbols(value int16) (r3 rune, r2 rune, r1 rune, r0 rune) {
return hexadecarunes.EncodeInt16UsingPersianSymbols(value)
}
func EncodeInt16UsingUpperCaseSymbols(value int16) (r3 byte, r2 byte, r1 byte, r0 byte) {
return hexadecabytes.EncodeInt16UsingUpperCaseSymbols(value)
}

View File

@ -0,0 +1,24 @@
package hexadecarunes
import (
"sourcecode.social/reiver/go-hexadeca/symbols/rune"
)
func EncodeInt16(value int16, symbolFunc func(byte)rune) (r3 rune, r2 rune, r1 rune, r0 rune) {
r3, r2 = EncodeByte(byte(0x00ff & (value >> (8 ))), symbolFunc)
r1, r0 = EncodeByte(byte(0x00ff & value ), symbolFunc)
return
}
func EncodeInt16UsingLowerCaseSymbols(value int16) (r3 rune, r2 rune, r1 rune, r0 rune) {
return EncodeInt16(value, runesymbols.LowerCase)
}
func EncodeInt16UsingPersianSymbols(value int16) (r3 rune, r2 rune, r1 rune, r0 rune) {
return EncodeInt16(value, runesymbols.Persian)
}
func EncodeInt16UsingUpperCaseSymbols(value int16) (r3 rune, r2 rune, r1 rune, r0 rune) {
return EncodeInt16(value, runesymbols.UpperCase)
}