From 33e1de2710fe44512440e0e6055578d67dab330c Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 18 Aug 2025 17:45:13 +0200 Subject: First sketch of wayland interface **WARNING** this implementation is not working properly yet. --- src/types.zig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/types.zig (limited to 'src/types.zig') diff --git a/src/types.zig b/src/types.zig new file mode 100644 index 0000000..2849af1 --- /dev/null +++ b/src/types.zig @@ -0,0 +1,18 @@ +const std = @import("std"); + +pub const Fd = struct { fd: std.posix.fd_t }; + +pub const Fixed = struct { + n: u24, + f: u8, + + pub fn from_f64(float: f64) @This() { + const n: u24 = @intFromFloat(float); + const f: u8 = @intFromFloat(std.math.maxInt(u8) * (float - @as(f64, @floatFromInt(n)))); + + return .{ + .n = n, + .f = f, + }; + } +}; -- cgit v1.2.3-70-g09d2