[hexxy] move dev to main and remove unused functions

This commit is contained in:
mizi 2024-02-01 16:22:54 -09:00
parent 25db94290c
commit c5c01b4f77

View file

@ -2,7 +2,6 @@ package main
import ( import (
"strconv" "strconv"
"unsafe"
) )
const GREY = "\x1b[38;2;111;111;111m" const GREY = "\x1b[38;2;111;111;111m"
@ -46,22 +45,3 @@ func (c *Color) Colorize(s string, clr byte) string {
func (c *Color) Colorize2(clr byte) ([]byte, []byte) { func (c *Color) Colorize2(clr byte) ([]byte, []byte) {
return c.cvalues[clr], CLRR return c.cvalues[clr], CLRR
} }
func IntToByteArray(num int) []byte {
size := int(unsafe.Sizeof(num))
arr := make([]byte, size)
for i := 0; i < size; i++ {
byt := *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&num)) + uintptr(i)))
arr[i] = byt
}
return arr
}
func ByteArrayToInt(arr []byte) int64 {
val := int64(0)
size := len(arr)
for i := 0; i < size; i++ {
*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&val)) + uintptr(i))) = arr[i]
}
return val
}