mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
- fork go-wayland/client and modify to make it thread-safe internally - use sync.Map and atomic values in many places to cut down on mutex boilerplate - do not create extworkspace client unless explicitly requested
25 lines
437 B
Go
25 lines
437 B
Go
package client
|
|
|
|
import "math"
|
|
|
|
// From wayland/wayland-util.h
|
|
|
|
func fixedToFloat64(f int32) float64 {
|
|
u_i := (1023+44)<<52 + (1 << 51) + int64(f)
|
|
u_d := math.Float64frombits(uint64(u_i))
|
|
return u_d - (3 << 43)
|
|
}
|
|
|
|
func fixedFromfloat64(d float64) int32 {
|
|
u_d := d + (3 << (51 - 8))
|
|
u_i := int64(math.Float64bits(u_d))
|
|
return int32(u_i)
|
|
}
|
|
|
|
func PaddedLen(l int) int {
|
|
if (l & 0x3) != 0 {
|
|
return l + (4 - (l & 0x3))
|
|
}
|
|
return l
|
|
}
|