mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 01:14:03 +03:00
FILE / ScuroNeko/mtg
utils/uint24.go
Исходный файл и его история в репозитории.
12 lines
302 B
Go
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
|
|
}
|