FILE / ScuroNeko/mtg

utils/uint24.go

Исходный файл и его история в репозитории.
FILE 6f3abf09900d0a720ddce560e4722f49eab993dc
Files
mtg/utils/uint24.go
T
2022-03-19 14:36:04 +03:00

12 lines
302 B
Go

package utils
type Uint24 [3]byte
func ToUint24(number uint32) Uint24 {
return Uint24{byte(number), byte(number >> 8), byte(number >> 16)} // nolint: gomnd
}
func FromUint24(number Uint24) uint32 {
return uint32(number[0]) + (uint32(number[1]) << 8) + (uint32(number[2]) << 16) // nolint: gomnd
}