mirror of
https://github.com/qrtc/ffmpeg-dev-go.git
synced 2025-10-05 15:47:33 +08:00
2023-10-29 08:11:29 CST W44D0
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
// Copyright (c) 2023 QRTC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ffmpeg
|
||||
|
||||
/*
|
||||
@@ -113,3 +117,16 @@ func VoidPointerPointer(a CVoidPointerPointer) *unsafe.Pointer {
|
||||
}
|
||||
return (*unsafe.Pointer)(unsafe.Pointer(reflect.ValueOf(a).Pointer()))
|
||||
}
|
||||
|
||||
// CondExpr is Conditional Operator like Ternary Operator in the C world.
|
||||
func CondExpr[T any](cond bool, x, y T) T {
|
||||
if cond {
|
||||
return x
|
||||
}
|
||||
return y
|
||||
}
|
||||
|
||||
func PlusPlus[T Integer](x *T) T {
|
||||
defer func() { *x++ }()
|
||||
return *x
|
||||
}
|
||||
|
Reference in New Issue
Block a user