Compare commits

..

2 Commits

Author SHA1 Message Date
Charles Iliya Krempeaux 17a2a394f6 initial commits 2023-10-27 21:45:20 -07:00
Charles Iliya Krempeaux 43834937c7 initial commits 2023-10-27 21:42:55 -07:00
4 changed files with 1774 additions and 14 deletions

View File

@ -0,0 +1,26 @@
package hexadecabytes
import (
"sourcecode.social/reiver/go-hexadeca/symbols/byte"
)
func EncodeUint64(value uint64, symbolFunc func(byte)byte) (r15 byte, r14 byte, r13 byte, r12 byte, r11 byte, r10 byte, r9 byte, r8 byte, r7 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
r15, r14 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 7))), symbolFunc)
r13, r12 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 6))), symbolFunc)
r11, r10 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 5))), symbolFunc)
r9, r8 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 4))), symbolFunc)
r7, r6 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 3))), symbolFunc)
r5, r4 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 2))), symbolFunc)
r3, r2 = EncodeByte(byte(0x00000000000000ff & (value >> (8 ))), symbolFunc)
r1, r0 = EncodeByte(byte(0x00000000000000ff & value ), symbolFunc)
return
}
func EncodeUint64UsingLowerCaseSymbols(value uint64) (r15 byte, r14 byte, r13 byte, r12 byte, r11 byte, r10 byte, r9 byte, r8 byte, r7 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
return EncodeUint64(value, bytesymbols.LowerCase)
}
func EncodeUint64UsingUpperCaseSymbols(value uint64) (r15 byte, r14 byte, r13 byte, r12 byte, r11 byte, r10 byte, r9 byte, r8 byte, r7 byte, r6 byte, r5 byte, r4 byte, r3 byte, r2 byte, r1 byte, r0 byte) {
return EncodeUint64(value, bytesymbols.UpperCase)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,18 @@
package hexadeca package hexadecarunes
import ( import (
"sourcecode.social/reiver/go-hexadeca/enc/runes"
"sourcecode.social/reiver/go-hexadeca/symbols/rune" "sourcecode.social/reiver/go-hexadeca/symbols/rune"
) )
func EncodeUint64(value uint64, 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) { func EncodeUint64(value uint64, 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) {
r15, r14 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 7))), symbolFunc) r15, r14 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 7))), symbolFunc)
r13, r12 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 6))), symbolFunc) r13, r12 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 6))), symbolFunc)
r11, r10 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 5))), symbolFunc) r11, r10 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 5))), symbolFunc)
r9, r8 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 4))), symbolFunc) r9, r8 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 4))), symbolFunc)
r7, r6 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 3))), symbolFunc) r7, r6 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 3))), symbolFunc)
r5, r4 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 * 2))), symbolFunc) r5, r4 = EncodeByte(byte(0x00000000000000ff & (value >> (8 * 2))), symbolFunc)
r3, r2 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & (value >> (8 ))), symbolFunc) r3, r2 = EncodeByte(byte(0x00000000000000ff & (value >> (8 ))), symbolFunc)
r1, r0 = hexadecarunes.EncodeByte(byte(0x00000000000000ff & value ), symbolFunc) r1, r0 = EncodeByte(byte(0x00000000000000ff & value ), symbolFunc)
return return
} }

View File

@ -1,9 +1,9 @@
package hexadeca_test package hexadecarunes_test
import ( import (
"testing" "testing"
"sourcecode.social/reiver/go-hexadeca" "sourcecode.social/reiver/go-hexadeca/enc/runes"
) )
func TestEncodeUint64UsingLowerCaseSymbols(t *testing.T) { func TestEncodeUint64UsingLowerCaseSymbols(t *testing.T) {
@ -842,7 +842,7 @@ func TestEncodeUint64UsingLowerCaseSymbols(t *testing.T) {
for testNumber, test := range tests { for testNumber, test := range tests {
actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadeca.EncodeUint64UsingLowerCaseSymbols(test.Value) actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadecarunes.EncodeUint64UsingLowerCaseSymbols(test.Value)
expected15, expected14, expected13, expected12, expected11, expected10, expected9, expected8, expected7, expected6, expected5, expected4, expected3, expected2, expected1, expected0 := test.Expected15, test.Expected14, test.Expected13, test.Expected12, test.Expected11, test.Expected10, test.Expected9, test.Expected8, test.Expected7, test.Expected6, test.Expected5, test.Expected4, test.Expected3, test.Expected2, test.Expected1, test.Expected0 expected15, expected14, expected13, expected12, expected11, expected10, expected9, expected8, expected7, expected6, expected5, expected4, expected3, expected2, expected1, expected0 := test.Expected15, test.Expected14, test.Expected13, test.Expected12, test.Expected11, test.Expected10, test.Expected9, test.Expected8, test.Expected7, test.Expected6, test.Expected5, test.Expected4, test.Expected3, test.Expected2, test.Expected1, test.Expected0
if expected15 != actual15 || if expected15 != actual15 ||
@ -1706,7 +1706,7 @@ func TestEncodeUint64UsingUpperCaseSymbols(t *testing.T) {
for testNumber, test := range tests { for testNumber, test := range tests {
actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadeca.EncodeUint64UsingUpperCaseSymbols(test.Value) actual15, actual14, actual13, actual12, actual11, actual10, actual9, actual8, actual7, actual6, actual5, actual4, actual3, actual2, actual1, actual0 := hexadecarunes.EncodeUint64UsingUpperCaseSymbols(test.Value)
expected15, expected14, expected13, expected12, expected11, expected10, expected9, expected8, expected7, expected6, expected5, expected4, expected3, expected2, expected1, expected0 := test.Expected15, test.Expected14, test.Expected13, test.Expected12, test.Expected11, test.Expected10, test.Expected9, test.Expected8, test.Expected7, test.Expected6, test.Expected5, test.Expected4, test.Expected3, test.Expected2, test.Expected1, test.Expected0 expected15, expected14, expected13, expected12, expected11, expected10, expected9, expected8, expected7, expected6, expected5, expected4, expected3, expected2, expected1, expected0 := test.Expected15, test.Expected14, test.Expected13, test.Expected12, test.Expected11, test.Expected10, test.Expected9, test.Expected8, test.Expected7, test.Expected6, test.Expected5, test.Expected4, test.Expected3, test.Expected2, test.Expected1, test.Expected0
if expected15 != actual15 || if expected15 != actual15 ||