mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-05 08:36:56 +08:00
初步与rtmp插件调通
This commit is contained in:
@@ -10,8 +10,17 @@ func PutBE[T constraints.Integer](b []byte, num T) []byte {
|
||||
}
|
||||
|
||||
func ReadBE[T constraints.Integer](b []byte) (num T) {
|
||||
num = 0
|
||||
for i, n := 0, len(b); i < n; i++ {
|
||||
num += T(b[i]) << ((n - i - 1) << 3)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetBE[T constraints.Integer](b []byte, num *T) T {
|
||||
*num = 0
|
||||
for i, n := 0, len(b); i < n; i++ {
|
||||
*num += T(b[i]) << ((n - i - 1) << 3)
|
||||
}
|
||||
return *num
|
||||
}
|
||||
|
Reference in New Issue
Block a user